Search in sources :

Example 1 with JmsSyncConsumer

use of com.adaptris.core.jms.JmsSyncConsumer in project interlok by adaptris.

the class ActiveMqJmsSyncConsumerTest method createConsumer.

private JmsSyncConsumer createConsumer(String threadName, String destinationName, Poller poller) {
    JmsSyncConsumer consumer = new JmsSyncConsumer().withEndpoint(destinationName);
    consumer.setPoller(poller);
    consumer.setReacquireLockBetweenMessages(true);
    return consumer;
}
Also used : JmsSyncConsumer(com.adaptris.core.jms.JmsSyncConsumer)

Example 2 with JmsSyncConsumer

use of com.adaptris.core.jms.JmsSyncConsumer in project interlok by adaptris.

the class ActiveMqJmsSyncConsumerTest method testTopic_ProduceConsume.

@Test
public void testTopic_ProduceConsume() throws Exception {
    int msgCount = 5;
    String rfc6167 = "jms:topic:" + testName.getMethodName() + "?subscriptionId=" + testName.getMethodName();
    final StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167));
    Sometime poller = new Sometime();
    JmsSyncConsumer consumer = createConsumer(testName.getMethodName(), rfc6167, poller);
    final StandaloneConsumer receiver = new StandaloneConsumer(activeMqBroker.getJmsConnection(), consumer);
    try {
        MockMessageListener jms = new MockMessageListener();
        receiver.registerAdaptrisMessageListener(jms);
        startAndStop(receiver);
        start(receiver);
        start(sender);
        for (int i = 0; i < msgCount; i++) {
            sender.doService(createMessage());
        }
        waitForMessages(jms, msgCount);
        assertMessages(jms, msgCount);
    } finally {
        shutdownQuietly(sender, receiver);
    }
}
Also used : JmsSyncConsumer(com.adaptris.core.jms.JmsSyncConsumer) JmsProducer(com.adaptris.core.jms.JmsProducer) Sometime(com.adaptris.core.jms.activemq.ActiveMqPasPollingConsumerTest.Sometime) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Aggregations

JmsSyncConsumer (com.adaptris.core.jms.JmsSyncConsumer)2 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)1 StandaloneProducer (com.adaptris.core.StandaloneProducer)1 JmsProducer (com.adaptris.core.jms.JmsProducer)1 Sometime (com.adaptris.core.jms.activemq.ActiveMqPasPollingConsumerTest.Sometime)1 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)1 Test (org.junit.Test)1