use of com.adaptris.core.StandaloneProducer in project interlok by adaptris.
the class AdvancedActiveMqProducerTest method testQueueProduceAndConsumeWithRedeliveryPolicy.
@Test
public void testQueueProduceAndConsumeWithRedeliveryPolicy() throws Exception {
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl(createRedelivery(), null)), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl(createRedelivery(), null)), new PtpProducer().withQueue((getName())));
execute(standaloneConsumer, standaloneProducer, createMessage(), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.StandaloneProducer in project interlok by adaptris.
the class BasicActiveMqConsumerTest method testTopicProduceAndConsumeWithExplicitFallbackMessageTranslation.
@Test
public void testTopicProduceAndConsumeWithExplicitFallbackMessageTranslation() throws Exception {
PasConsumer consumer = new PasConsumer().withTopic(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setMessageTranslator(new AutoConvertMessageTranslator());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
DefinedJmsProducer producer = new PasProducer().withTopic(getName());
producer.setMessageTranslator(new BytesMessageTranslator());
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
assertMessages(jms, 1);
}
use of com.adaptris.core.StandaloneProducer in project interlok by adaptris.
the class BasicActiveMqConsumerTest method testQueue_ProduceWhenConsumerStopped.
@Test
public void testQueue_ProduceWhenConsumerStopped() throws Exception {
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
StandardWorkflow workflow = new StandardWorkflow();
MockMessageProducer producer = new MockMessageProducer();
workflow.setConsumer(consumer);
workflow.setProducer(producer);
Channel channel = createChannel(activeMqBroker.getJmsConnection(createVendorImpl()), workflow);
try {
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), new PtpProducer().withQueue((getName())));
channel.requestStart();
workflow.requestStop();
start(standaloneProducer);
AdaptrisMessage msg = createMessage(null);
standaloneProducer.produce(msg);
Thread.sleep(250);
assertEquals(0, producer.messageCount());
stop(standaloneProducer);
} finally {
channel.requestClose();
}
}
use of com.adaptris.core.StandaloneProducer in project interlok by adaptris.
the class BasicActiveMqConsumerTest method testBlobProduceAndConsumeWithFileMessageFactory.
@Test
public void testBlobProduceAndConsumeWithFileMessageFactory() throws Exception {
if (!ExternalResourcesHelper.isExternalServerAvailable()) {
log.debug("Blob Server not available; skipping test");
return;
}
PtpConsumer consumer = new PtpConsumer().withQueue(getName());
consumer.setAcknowledgeMode("AUTO_ACKNOWLEDGE");
consumer.setMessageTranslator(new BlobMessageTranslator());
StandaloneConsumer standaloneConsumer = new StandaloneConsumer(activeMqBroker.getJmsConnection(createVendorImpl()), consumer);
MockMessageListener jms = new MockMessageListener();
standaloneConsumer.registerAdaptrisMessageListener(jms);
PtpProducer producer = new PtpProducer().withQueue((getName()));
producer.setMessageTranslator(new BlobMessageTranslator("blobUrl"));
StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
execute(standaloneConsumer, standaloneProducer, addBlobUrlRef(createMessage(new FileBackedMessageFactory()), "blobUrl"), jms);
assertMessages(jms, 1, false);
}
use of com.adaptris.core.StandaloneProducer in project interlok by adaptris.
the class BasicActiveMqImplementationTest method testRfc6167_Basic.
@Test
public void testRfc6167_Basic() throws Exception {
StandaloneProducer producer = null;
try {
BasicActiveMqImplementation vendorImp = create();
PtpProducer ptp = new PtpProducer().withQueue((testName.getMethodName()));
producer = new StandaloneProducer(activeMqBroker.getJmsConnection(vendorImp), ptp);
start(producer);
// Send a message so that the session is correct.
producer.doService(AdaptrisMessageFactory.getDefaultInstance().newMessage("abcde"));
JmsDestination jmsDest = vendorImp.createDestination("jms:queue:myQueueName", ptp);
assertNotNull(jmsDest.getDestination());
assertTrue(javax.jms.Queue.class.isAssignableFrom(jmsDest.getDestination().getClass()));
assertNull(jmsDest.deliveryMode());
assertNull(jmsDest.getReplyToDestination());
assertNull(jmsDest.priority());
assertNull(jmsDest.timeToLive());
assertNull(jmsDest.subscriptionId());
assertFalse(jmsDest.noLocal());
} finally {
stop(producer);
}
}
Aggregations