use of com.adaptris.core.jms.JmsPollingConsumer in project interlok by adaptris.
the class ActiveMqJmsPollingConsumerTest method createConsumer.
private JmsPollingConsumer createConsumer(EmbeddedActiveMq broker, String threadName, String destinationName, Poller poller) {
JmsPollingConsumer consumer = new JmsPollingConsumer().withEndpoint(destinationName);
consumer.setPoller(poller);
JmsConnection c = broker.getJmsConnection();
consumer.setClientId(c.configuredClientId());
consumer.setUserName(c.configuredUserName());
consumer.setPassword(c.configuredPassword());
consumer.setReacquireLockBetweenMessages(true);
consumer.setVendorImplementation(c.getVendorImplementation());
return consumer;
}
use of com.adaptris.core.jms.JmsPollingConsumer in project interlok by adaptris.
the class ActiveMqJmsPollingConsumerTest 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();
JmsPollingConsumer consumer = createConsumer(activeMqBroker, testName.getMethodName(), rfc6167, poller);
final StandaloneConsumer receiver = new StandaloneConsumer(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