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;
}
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);
}
}
Aggregations