Search in sources :

Example 16 with ActiveMQQueue

use of org.apache.activemq.command.ActiveMQQueue in project ignite by apache.

the class IgniteJmsStreamerTest method testQueueFromExplicitDestination.

/**
     * @throws Exception If failed.
     */
public void testQueueFromExplicitDestination() throws Exception {
    Destination dest = new ActiveMQQueue(QUEUE_NAME);
    // produce messages into the queue
    produceObjectMessages(dest, false);
    try (IgniteDataStreamer<String, String> dataStreamer = grid().dataStreamer(DEFAULT_CACHE_NAME)) {
        JmsStreamer<ObjectMessage, String, String> jmsStreamer = newJmsStreamer(ObjectMessage.class, dataStreamer);
        jmsStreamer.setDestination(dest);
        // subscribe to cache PUT events and return a countdown latch starting at CACHE_ENTRY_COUNT
        CountDownLatch latch = subscribeToPutEvents(CACHE_ENTRY_COUNT);
        // start the streamer
        jmsStreamer.start();
        // all cache PUT events received in 10 seconds
        latch.await(10, TimeUnit.SECONDS);
        assertAllCacheEntriesLoaded();
        jmsStreamer.stop();
    }
}
Also used : Destination(javax.jms.Destination) ObjectMessage(javax.jms.ObjectMessage) ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)16 Destination (javax.jms.Destination)10 CountDownLatch (java.util.concurrent.CountDownLatch)9 TextMessage (javax.jms.TextMessage)8 Test (org.junit.Test)6 ObjectMessage (javax.jms.ObjectMessage)3 DestinationStatistics (org.apache.activemq.broker.region.DestinationStatistics)3 JMSException (javax.jms.JMSException)2 Message (javax.jms.Message)2 MessageConsumer (javax.jms.MessageConsumer)2 MessageProducer (javax.jms.MessageProducer)2 ActiveMQMessageConsumer (org.apache.activemq.ActiveMQMessageConsumer)2 ActiveMQSession (org.apache.activemq.ActiveMQSession)2 Subscription (org.apache.activemq.broker.region.Subscription)2 AssertTextMessageListener (com.navercorp.pinpoint.plugin.jdk7.activemq.client.util.AssertTextMessageListener)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 Session (javax.jms.Session)1 ConnectionContext (org.apache.activemq.broker.ConnectionContext)1 Destination (org.apache.activemq.broker.region.Destination)1 PolicyEntry (org.apache.activemq.broker.region.policy.PolicyEntry)1