use of com.adaptris.core.jms.PtpConsumer 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.jms.PtpConsumer in project interlok by adaptris.
the class JndiPtpProducerCase method testProduceAndConsumeUsingJndiOnly.
@Test
public void testProduceAndConsumeUsingJndiOnly() throws Exception {
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPtpConnection(recvVendorImp, true, queueName, topicName), new PtpConsumer().withQueue(queueName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPtpConnection(sendVendorImp, true, queueName, topicName), new PtpProducer().withQueue((queueName)));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms);
}
use of com.adaptris.core.jms.PtpConsumer in project interlok by adaptris.
the class JndiPtpProducerCase method testProduceAndConsume_ExtraConfig.
@Test
public void testProduceAndConsume_ExtraConfig() throws Exception {
SimpleFactoryConfiguration sfc = new SimpleFactoryConfiguration();
KeyValuePairSet kvps = new KeyValuePairSet();
kvps.add(new KeyValuePair("ClientID", "testProduceAndConsume_ExtraConfig"));
kvps.add(new KeyValuePair("UseCompression", "true"));
sfc.setProperties(kvps);
String queueName = testName.getMethodName() + "_queue";
String topicName = testName.getMethodName() + "_topic";
StandardJndiImplementation recvVendorImp = createVendorImplementation();
StandardJndiImplementation sendVendorImp = createVendorImplementation();
sendVendorImp.setExtraFactoryConfiguration(sfc);
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJndiPtpConnection(recvVendorImp, false, queueName, topicName), new PtpConsumer().withQueue(queueName));
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJndiPtpConnection(sendVendorImp, false, queueName, topicName), new PtpProducer().withQueue((queueName)));
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms);
}
use of com.adaptris.core.jms.PtpConsumer in project interlok by adaptris.
the class RequestReplyWorkflowTest method retrieveObjectForSampleConfig.
@Override
protected Object retrieveObjectForSampleConfig() {
Channel c = new Channel();
try {
c.setConsumeConnection(new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:61616")));
c.setProduceConnection(new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:2506")));
RequestReplyWorkflow workflow = new RequestReplyWorkflow();
workflow.getServiceCollection().addService(new Base64DecodeService());
workflow.setConsumer(new PtpConsumer().withQueue("inputQueue"));
workflow.setProducer(new PtpProducer().withQueue("outputQueue"));
workflow.setReplyProducer(new PtpProducer().withQueue("TODO"));
workflow.getReplyServiceCollection().addService(new Base64EncodeService());
c.getWorkflowList().add(workflow);
c.setUniqueId(UUID.randomUUID().toString());
workflow.setUniqueId(UUID.randomUUID().toString());
} catch (CoreException e) {
throw new RuntimeException(e);
}
return c;
}
use of com.adaptris.core.jms.PtpConsumer 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);
}
Aggregations