Search in sources :

Example 26 with PtpConsumer

use of com.adaptris.core.jms.PtpConsumer in project interlok by adaptris.

the class BasicActiveMqConsumerTest method testQueueProduceAndConsumeWithImplicitFallbackMessageTranslation.

@Test
public void testQueueProduceAndConsumeWithImplicitFallbackMessageTranslation() 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);
    DefinedJmsProducer producer = new PtpProducer().withQueue((getName()));
    producer.setMessageTranslator(new BytesMessageTranslator());
    StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
    execute(standaloneConsumer, standaloneProducer, createMessage(null), jms);
    assertMessages(jms, 1);
}
Also used : PtpConsumer(com.adaptris.core.jms.PtpConsumer) DefinedJmsProducer(com.adaptris.core.jms.DefinedJmsProducer) PtpProducer(com.adaptris.core.jms.PtpProducer) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) BytesMessageTranslator(com.adaptris.core.jms.BytesMessageTranslator) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Example 27 with PtpConsumer

use of com.adaptris.core.jms.PtpConsumer in project interlok by adaptris.

the class JndiPtpProducerCase 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.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);
}
Also used : PtpConsumer(com.adaptris.core.jms.PtpConsumer) StandardJndiImplementation(com.adaptris.core.jms.jndi.StandardJndiImplementation) PtpProducer(com.adaptris.core.jms.PtpProducer) StandaloneConsumer(com.adaptris.core.StandaloneConsumer) MockMessageListener(com.adaptris.core.stubs.MockMessageListener) StandaloneProducer(com.adaptris.core.StandaloneProducer) Test(org.junit.Test)

Aggregations

PtpConsumer (com.adaptris.core.jms.PtpConsumer)27 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)24 PtpProducer (com.adaptris.core.jms.PtpProducer)24 StandaloneProducer (com.adaptris.core.StandaloneProducer)23 Test (org.junit.Test)23 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)22 JmsConnection (com.adaptris.core.jms.JmsConnection)5 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)3 BytesMessageTranslator (com.adaptris.core.jms.BytesMessageTranslator)3 StandardJndiImplementation (com.adaptris.core.jms.jndi.StandardJndiImplementation)3 DefinedJmsProducer (com.adaptris.core.jms.DefinedJmsProducer)2 TextMessageTranslator (com.adaptris.core.jms.TextMessageTranslator)2 UrlVendorImplementation (com.adaptris.core.jms.UrlVendorImplementation)2 FileBackedMessageFactory (com.adaptris.core.lms.FileBackedMessageFactory)2 MockChannel (com.adaptris.core.stubs.MockChannel)2 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)2 Channel (com.adaptris.core.Channel)1 MimeEncoder (com.adaptris.core.MimeEncoder)1 StandardWorkflow (com.adaptris.core.StandardWorkflow)1 AutoConvertMessageTranslator (com.adaptris.core.jms.AutoConvertMessageTranslator)1