use of com.adaptris.core.jms.PasProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testTopicProduceWithPerMessagePropertiesDisabled.
@Test
public void testTopicProduceWithPerMessagePropertiesDisabled() throws Exception {
TopicLoopback echo = new TopicLoopback(activeMqBroker, getName());
try {
echo.start();
PasProducer pasProducer = new PasProducer().withTopic(getName());
pasProducer.setDeliveryMode(String.valueOf(DeliveryMode.PERSISTENT));
pasProducer.setPriority(LOWEST_PRIORITY);
pasProducer.setTtl(0L);
pasProducer.setPerMessageProperties(false);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), pasProducer);
ExampleServiceCase.execute(standaloneProducer, createMessage());
echo.waitFor(DEFAULT_TIMEOUT);
assertNotNull(echo.getLastMessage());
assertEquals(LOWEST_PRIORITY, echo.getLastMessage().getJMSPriority());
assertEquals(DeliveryMode.PERSISTENT, echo.getLastMessage().getJMSDeliveryMode());
} finally {
echo.stop();
}
}
use of com.adaptris.core.jms.PasProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testTopicProduceAndConsume_WithEncoder.
@Test
public void testTopicProduceAndConsume_WithEncoder() throws Exception {
PasConsumer consumer = new PasConsumer().withTopic(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setEncoder(new MimeEncoder());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
PasProducer producer = new PasProducer().withTopic(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.PasProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testTopicProduceAndConsume.
@Test
public void testTopicProduceAndConsume() throws Exception {
PasConsumer consumer = new PasConsumer().withTopic(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 PasProducer().withTopic(getName()));
execute(standaloneConsumer, standaloneProducer, createMessage(), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.jms.PasProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testTopicProduce_WithStaticReplyTo.
@Test
public void testTopicProduce_WithStaticReplyTo() throws Exception {
TopicLoopback echo = new TopicLoopback(activeMqBroker, getName());
try {
echo.start();
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PasProducer().withTopic(getName()));
AdaptrisMessage msg = EmbeddedActiveMq.createMessage(null);
msg.addMetadata(JmsConstants.JMS_ASYNC_STATIC_REPLY_TO, getName() + "_reply");
ExampleServiceCase.execute(standaloneProducer, msg);
echo.waitFor(DEFAULT_TIMEOUT);
assertNotNull(echo.getLastMessage());
assertNotNull(echo.getLastMessage().getJMSReplyTo());
assertEquals("topic://" + getName() + "_reply", echo.getLastMessage().getJMSReplyTo().toString());
} finally {
echo.stop();
}
}
use of com.adaptris.core.jms.PasProducer in project interlok by adaptris.
the class BasicActiveMqProducerTest method testTopicRequestReplyWithMessageWrongType.
@Test
public void testTopicRequestReplyWithMessageWrongType() throws Exception {
TopicLoopback echo = new TopicLoopback(activeMqBroker, getName(), false);
try {
echo.start();
PasProducer producer = new PasProducer().withTopic(getName());
producer.setMessageTranslator(new BytesMessageTranslator());
StandaloneRequestor req = new StandaloneRequestor(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
AdaptrisMessage msg = createMessage();
ExampleServiceCase.execute(req, msg);
echo.waitFor(DEFAULT_TIMEOUT);
assertNotNull(echo.getLastMessage());
assertNotNull(echo.getLastMessage().getJMSReplyTo());
} finally {
echo.stop();
}
}
Aggregations