use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testQueueProduceAndConsume_WithEncoder.
@Test
public void testQueueProduceAndConsume_WithEncoder() throws Exception {
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setEncoder(new MimeEncoder());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
PtpProducer producer = new PtpProducer().withQueue((getName()));
producer.setEncoder(new MimeEncoder());
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
execute(standaloneConsumer, standaloneProducer, createMessage(), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class ActiveMqJmsPollingConsumerTest method testQueue_ProduceConsume.
@Test
public void testQueue_ProduceConsume() throws Exception {
int msgCount = 5;
String rfc6167 = "jms:queue:" + testName.getMethodName();
final StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167));
final StandaloneConsumer receiver = createStandaloneConsumer(activeMqBroker, testName.getMethodName(), rfc6167);
try {
MockMessageListener jms = new MockMessageListener();
receiver.registerAdaptrisMessageListener(jms);
// INTERLOK-3329 For coverage so the prepare() warning is executed 2x
LifecycleHelper.prepare(sender);
LifecycleHelper.prepare(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);
}
}
use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class ActiveMqJmsSyncConsumerTest method testQueue_ProduceConsume.
@Test
public void testQueue_ProduceConsume() throws Exception {
int msgCount = 5;
String rfc6167 = "jms:queue:" + testName.getMethodName();
final StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(), new JmsProducer().withEndpoint(rfc6167));
final StandaloneConsumer receiver = createStandaloneConsumer(activeMqBroker, testName.getMethodName(), rfc6167);
try {
MockMessageListener jms = new MockMessageListener();
receiver.registerAdaptrisMessageListener(jms);
// INTERLOK-3329 For coverage so the prepare() warning is executed 2x
LifecycleHelper.prepare(sender);
LifecycleHelper.prepare(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);
}
}
use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class ActiveMqJmsSyncConsumerTest method testTopic_NoSubscriptionId.
@Test
public void testTopic_NoSubscriptionId() throws Exception {
String rfc6167 = "jms:topic:" + testName.getMethodName();
final StandaloneConsumer consumer = createStandaloneConsumer(activeMqBroker, testName.getMethodName(), rfc6167);
try {
consumer.registerAdaptrisMessageListener(new MockMessageListener());
// This won't fail, but... there will be errors in the log file...
start(consumer);
} finally {
shutdownQuietly(null, consumer);
}
}
use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class PasConsumerTest method retrieveSampleConfig.
protected StandaloneConsumer retrieveSampleConfig() {
JmsConnection c = new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:16161"));
PasConsumer pc = new PasConsumer();
pc.setTopic("destination");
NullCorrelationIdSource mcs = new NullCorrelationIdSource();
pc.setCorrelationIdSource(mcs);
c.setConnectionErrorHandler(new JmsConnectionErrorHandler());
pc.setSubscriptionId("subscription-id");
StandaloneConsumer result = new StandaloneConsumer();
result.setConnection(c);
result.setConsumer(pc);
return result;
}
Aggregations