use of com.adaptris.core.jms.PtpProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testQueueProduceAndConsume_ObjectEndpoint.
@Test
public void testQueueProduceAndConsume_ObjectEndpoint() throws Exception {
Queue queue = activeMqBroker.createQueue(getName());
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PtpProducer().withQueue("%messageObject{objectEndpoint}"));
AdaptrisMessage msg = createMessage();
msg.addObjectHeader("objectEndpoint", queue);
execute(standaloneConsumer, standaloneProducer, msg, jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.jms.PtpProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testQueueRequestReply.
@Test
public void testQueueRequestReply() throws Exception {
QueueLoopback echo = new QueueLoopback(activeMqBroker, getName());
try {
echo.start();
StandaloneRequestor standaloneProducer = new StandaloneRequestor(activeMqBroker.getJmsConnection(createVendorImpl()), new PtpProducer().withQueue((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();
}
}
use of com.adaptris.core.jms.PtpProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testQueueProduceAndConsume_ResolveableEndpoint.
@Test
public void testQueueProduceAndConsume_ResolveableEndpoint() throws Exception {
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PtpProducer().withQueue("%message{metadataEndpoint}"));
AdaptrisMessage msg = createMessage();
msg.addMessageHeader("metadataEndpoint", getName());
execute(standaloneConsumer, standaloneProducer, msg, jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.jms.PtpProducer 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.PtpProducer in project interlok by adaptris.
the class ActiveMqJmsTransactedWorkflowTest method testMessagesRolledBackUsingQueue.
@Test
public void testMessagesRolledBackUsingQueue() throws Exception {
int msgCount = 10;
String destination = createSafeUniqueId(new Object());
Channel channel = createStartableChannel(activeMqBroker, true, "testMessagesRolledBackUsingQueue", destination);
JmsTransactedWorkflow workflow = (JmsTransactedWorkflow) channel.getWorkflowList().get(0);
workflow.getServiceCollection().addService(new ThrowExceptionService(new ConfiguredException("Fail")));
try {
channel.requestStart();
StandaloneProducer sender = new StandaloneProducer(activeMqBroker.getJmsConnection(), new PtpProducer().withQueue((destination)));
send(sender, msgCount);
} finally {
channel.requestClose();
}
assertEquals(msgCount, activeMqBroker.messagesOnQueue(destination));
}
Aggregations