use of com.adaptris.core.StandaloneConsumer 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);
}
}
use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class FailoverPasProducerTest method testProduceAndConsume.
@Test
public void testProduceAndConsume() throws Exception {
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getFailoverJmsConnection(false), new PasConsumer().withTopic(testName.getMethodName()));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getFailoverJmsConnection(false), new PasProducer().withTopic(testName.getMethodName()));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class FailoverPtpProducerTest method testProduceAndConsume.
@Test
public void testProduceAndConsume() throws Exception {
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getFailoverJmsConnection(true), new PtpConsumer().withQueue(testName.getMethodName()));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getFailoverJmsConnection(true), new PtpProducer().withQueue((testName.getMethodName())));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class JndiPasProducerCase method testProduceAndConsume_ExtraConfig.
@Test
public void testProduceAndConsume_ExtraConfig() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
SimpleFactoryConfiguration sfc = new SimpleFactoryConfiguration();
KeyValuePairSet kvps = new KeyValuePairSet();
kvps.add(new KeyValuePair("ClientID", "testProduceAndConsume_ExtraConfig"));
kvps.add(new KeyValuePair("UseCompression", "true"));
sfc.setProperties(kvps);
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
sendVendorImp.setExtraFactoryConfiguration(sfc);
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPasConnection(recvVendorImp, false, queueName, topicName), new PasConsumer().withTopic(topicName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPasConnection(sendVendorImp, false, queueName, topicName), new PasProducer().withTopic(topicName));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.StandaloneConsumer in project interlok by adaptris.
the class JndiPasProducerCase method testProduceAndConsume.
@Test
public void testProduceAndConsume() throws Exception {
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPasConnection(recvVendorImp, false, queueName, topicName), new PasConsumer().withTopic(topicName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPasConnection(sendVendorImp, false, queueName, topicName), new PasProducer().withTopic(topicName));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms, 1);
}
Aggregations