use of com.adaptris.core.jms.PasProducer 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.jms.PasProducer 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);
}
use of com.adaptris.core.jms.PasProducer in project interlok by adaptris.
the class JndiPasProducerCase method testProduceAndConsumeUsingJndiOnly.
@Test
public void testProduceAndConsumeUsingJndiOnly() throws Exception {
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPasConnection(recvVendorImp, true, queueName, topicName), new PasConsumer().withTopic(topicName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPasConnection(sendVendorImp, true, queueName, topicName), new PasProducer().withTopic(topicName));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms);
}
use of com.adaptris.core.jms.PasProducer in project interlok by adaptris.
the class ActiveJmsConnectionErrorHandlerTest method createProducer.
private StandaloneProducer createProducer(EmbeddedActiveMq mq, String dest) {
JmsConnection conn = mq.getJmsConnection(new BasicActiveMqImplementation(), true);
conn.setConnectionErrorHandler(createErrorHandler());
PasProducer producer = new PasProducer().withTopic(dest);
return new StandaloneProducer(conn, producer);
}
use of com.adaptris.core.jms.PasProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testTopicRequestReply.
@Test
public void testTopicRequestReply() throws Exception {
TopicLoopback echo = new TopicLoopback(activeMqBroker, getName());
try {
echo.start();
StandaloneRequestor standaloneProducer = new StandaloneRequestor(activeMqBroker.getJmsConnection(createVendorImpl()), new PasProducer().withTopic(getName()));
AdaptrisMessage msg = createMessage();
ExampleServiceCase.execute(standaloneProducer, msg);
echo.waitFor(DEFAULT_TIMEOUT);
assertNotNull(echo.getLastMessage());
assertNotNull(echo.getLastMessage().getJMSReplyTo());
assertEquals(DEFAULT_PAYLOAD.toUpperCase(), msg.getContent());
} finally {
echo.stop();
}
}
Aggregations