Package net.timewalker.ffmq3.local.destination

Examples of net.timewalker.ffmq3.local.destination.AbstractLocalDestination


                break;
            Thread.sleep(100);
        }

        // When in non-transacted mode, the ack is sent _after_ message processing so we need to wait a bit
        LocalTopic localTopic = engine.getLocalTopic(params.destinationName);
        if (!params.receiverTransacted)
        {
            while (localTopic.getSize() > 0)
                Thread.sleep(10);
        }
       
        long endTime = System.currentTimeMillis();
        double rate = (double)totalExpected*1000/(endTime-startTime);
        System.out.println((endTime-startTime)+" ms ("+rateFormat.format(rate)+" msg/s)");

        int totalReceived = 0;
        for (int n = 0 ; n < receivers.length ; n++)
            totalReceived += receivers[n].getReceivedCount();

        int topicSize = localTopic.getSize();
        if (topicSize > 0)
        {
            System.out.println("Expected : "+totalExpected);
            System.out.println("Received : "+totalReceived);
            System.out.println(localTopic);
            System.out.println(localTopic.getConsumersSummary());              
            TestUtils.dumpThreads();
            TestUtils.hang();
        }

        // Close receivers
View Full Code Here


                break;
            Thread.sleep(100);
        }

        // When in non-transacted mode, the ack is sent _after_ message processing so we need to wait a bit
        LocalTopic localTopic = engine.getLocalTopic(params.destinationName);
        if (!params.receiverTransacted)
        {
          while (localTopic.getSize() > 0)
            Thread.sleep(10);
        }
       
        long endTime = System.currentTimeMillis();
        double rate = (double)totalExpected*1000/(endTime-startTime);
        System.out.println((endTime-startTime)+" ms ("+rateFormat.format(rate)+" msg/s)");

        int totalReceived = 0;
        for (int n = 0 ; n < receivers.length ; n++)
            totalReceived += receivers[n].getReceivedCount();

        int topicSize = localTopic.getSize();
        if (topicSize > 0)
        {
            System.out.println("Expected : "+totalExpected);
            System.out.println("Received : "+totalReceived);
            System.out.println(localTopic);
            System.out.println(localTopic.getConsumersSummary());              
            TestUtils.dumpThreads();
            TestUtils.hang();
        }

        // Close receivers
View Full Code Here

    }
   
    private CreateConsumerResponse processCreateDurableSubscriber( CreateDurableSubscriberQuery query ) throws JMSException
    {
        LocalSession session = lookupSession(query);
        LocalDurableTopicSubscriber subscriber = (LocalDurableTopicSubscriber)session.createDurableSubscriber(query.getConsumerId(),
                                                                                                          query.getTopic(),
                                                                                                              query.getName(),
                                                                                                              query.getMessageSelector(),
                                                                                                              query.isNoLocal());
       
        // Start prefetching
        subscriber.prefetchMore();
       
        CreateConsumerResponse response = new CreateConsumerResponse();
        response.setPrefetchSize(subscriber.getPrefetchSize());
       
        return response;
    }
View Full Code Here

    }
   
    private LocalMessageConsumer lookupConsumer( AbstractConsumerQuery query ) throws JMSException
    {
        LocalSession localSession = lookupSession(query);
        LocalMessageConsumer consumer = (LocalMessageConsumer)localSession.lookupRegisteredConsumer(query.getConsumerId());
        if (consumer == null)
            throw new FFMQException("Invalid consumer id : "+query.getConsumerId(),"NETWORK_ERROR");
        return consumer;
    }
View Full Code Here

        return new RollbackResponse();
    }
   
    private GetResponse processGet( GetQuery query ) throws JMSException
    {
        LocalMessageConsumer consumer = lookupConsumer(query);
        Message msg = consumer.receiveFromDestination(0,false);    
        GetResponse response = new GetResponse();
        response.setMessage((AbstractMessage)msg);
       
        return response;
    }
View Full Code Here

        return response;
    }
   
    private AbstractResponsePacket processPrefetch( PrefetchQuery query ) throws JMSException
    {
        LocalMessageConsumer consumer = lookupConsumer(query);
        consumer.prefetchMore();

        return null; // Async call
    }
View Full Code Here

        return response;
    }
   
    private CloseConsumerResponse processCloseConsumer( CloseConsumerQuery query ) throws JMSException
    {
        LocalMessageConsumer consumer = lookupConsumer(query);
        consumer.close();
       
        // Rollback undelivered prefetched messages
        List undeliveredMessageIDs = query.getUndeliveredMessageIDs();
        if (undeliveredMessageIDs != null && !undeliveredMessageIDs.isEmpty())
          ((LocalSession)consumer.getSession()).rollbackUndelivered(undeliveredMessageIDs);

        return new CloseConsumerResponse();
    }
View Full Code Here

            // Rollback undelivered prefetched messages
            List undeliveredMessageIDs = new ArrayList();
            undeliveredMessageIDs.add(query.getMessageId());
            localSession.rollbackUndelivered(undeliveredMessageIDs);
           
            LocalMessageConsumer consumer = (LocalMessageConsumer)localSession.lookupRegisteredConsumer(query.getConsumerId());
            if (consumer != null)
              consumer.restorePrefetchCapacity(1);
        }
       
        return new RollbackMessageResponse();
    }
View Full Code Here

    }
   
    private CreateConsumerResponse processCreateConsumer( CreateConsumerQuery query ) throws JMSException
    {
        LocalSession session = lookupSession(query);
        LocalMessageConsumer consumer = (LocalMessageConsumer)session.createConsumer(query.getConsumerId(),
                                                                                 query.getDestination(),
                                                                                     query.getMessageSelector(),
                                                                                     query.isNoLocal());
       
        // Start prefetching if we are receiving from a queue
        if (query.getDestination() instanceof Queue)
          consumer.prefetchMore();
       
        CreateConsumerResponse response = new CreateConsumerResponse();
        response.setPrefetchSize(consumer.getPrefetchSize());
       
        return response;
    }
View Full Code Here

    }
   
    private LocalQueueBrowser lookupBrowser( AbstractQueueBrowserQuery query ) throws JMSException
    {
        LocalSession localSession = lookupSession(query);
        LocalQueueBrowser browser = (LocalQueueBrowser)localSession.lookupRegisteredBrowser(query.getBrowserId());
        if (browser == null)
            throw new FFMQException("Invalid browser id : "+query.getBrowserId(),"NETWORK_ERROR");
        return browser;
    }
View Full Code Here

TOP

Related Classes of net.timewalker.ffmq3.local.destination.AbstractLocalDestination

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.