Search in sources :

Example 1 with TextMessageTranslator

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

the class ActiveMqJmsTransactedWorkflowTest method createWorkflow.

private JmsTransactedWorkflow createWorkflow(boolean isPtp, String threadName, String target) throws CoreException {
    JmsTransactedWorkflow workflow = new JmsTransactedWorkflow();
    workflow.setWaitPeriodAfterRollback(new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    workflow.setProducer(new MockMessageProducer());
    JmsConsumerImpl jmsCons = isPtp ? new PtpConsumer().withQueue(target) : new PasConsumer().withTopic(target);
    jmsCons.setMessageTranslator(new TextMessageTranslator().withMoveJmsHeaders(true));
    workflow.setConsumer(jmsCons);
    return workflow;
}
Also used : PtpConsumer(com.adaptris.core.jms.PtpConsumer) TimeInterval(com.adaptris.util.TimeInterval) MockMessageProducer(com.adaptris.core.stubs.MockMessageProducer) PasConsumer(com.adaptris.core.jms.PasConsumer) TextMessageTranslator(com.adaptris.core.jms.TextMessageTranslator) JmsTransactedWorkflow(com.adaptris.core.jms.JmsTransactedWorkflow) JmsConsumerImpl(com.adaptris.core.jms.JmsConsumerImpl)

Example 2 with TextMessageTranslator

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

the class ActiveMqJmsTransactedWorkflowTest method createPollingWorkflow.

private JmsTransactedWorkflow createPollingWorkflow(EmbeddedActiveMq mq, String threadName, String target) throws CoreException {
    JmsTransactedWorkflow workflow = new JmsTransactedWorkflow();
    workflow.setProducer(new MockMessageProducer());
    workflow.setWaitPeriodAfterRollback(new TimeInterval(10L, TimeUnit.MILLISECONDS.name()));
    JmsPollingConsumerImpl jmsCons = new PtpPollingConsumer().withQueue(target);
    jmsCons.setReacquireLockBetweenMessages(true);
    jmsCons.setAdditionalDebug(true);
    jmsCons.setPoller(new FixedIntervalPoller(new TimeInterval(2L, TimeUnit.SECONDS)));
    BasicActiveMqImplementation vendorImpl = new BasicActiveMqImplementation();
    JmsConnection jmsConn = mq.getJmsConnection(vendorImpl, true);
    jmsCons.setVendorImplementation(jmsConn.getVendorImplementation());
    jmsCons.setMessageTranslator(new TextMessageTranslator().withMoveJmsHeaders(true));
    jmsCons.setClientId(jmsConn.getClientId());
    workflow.setConsumer(jmsCons);
    return workflow;
}
Also used : JmsPollingConsumerImpl(com.adaptris.core.jms.JmsPollingConsumerImpl) MockMessageProducer(com.adaptris.core.stubs.MockMessageProducer) TimeInterval(com.adaptris.util.TimeInterval) TextMessageTranslator(com.adaptris.core.jms.TextMessageTranslator) PtpPollingConsumer(com.adaptris.core.jms.PtpPollingConsumer) JmsTransactedWorkflow(com.adaptris.core.jms.JmsTransactedWorkflow) JmsConnection(com.adaptris.core.jms.JmsConnection) FixedIntervalPoller(com.adaptris.core.FixedIntervalPoller)

Example 3 with TextMessageTranslator

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

the class BasicActiveMqProducerTest method testBlobConsumeWithNonBlob.

@Test
public void testBlobConsumeWithNonBlob() throws Exception {
    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 TextMessageTranslator());
    StandaloneProducer standaloneProducer = new StandaloneProducer(activeMqBroker.getJmsConnection(createVendorImpl()), producer);
    execute(standaloneConsumer, standaloneProducer, EmbeddedActiveMq.createMessage(null), jms);
    assertMessages(jms, 1, true);
}
Also used : PtpConsumer(com.adaptris.core.jms.PtpConsumer) TextMessageTranslator(com.adaptris.core.jms.TextMessageTranslator) 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

TextMessageTranslator (com.adaptris.core.jms.TextMessageTranslator)3 JmsTransactedWorkflow (com.adaptris.core.jms.JmsTransactedWorkflow)2 PtpConsumer (com.adaptris.core.jms.PtpConsumer)2 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)2 TimeInterval (com.adaptris.util.TimeInterval)2 FixedIntervalPoller (com.adaptris.core.FixedIntervalPoller)1 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)1 StandaloneProducer (com.adaptris.core.StandaloneProducer)1 JmsConnection (com.adaptris.core.jms.JmsConnection)1 JmsConsumerImpl (com.adaptris.core.jms.JmsConsumerImpl)1 JmsPollingConsumerImpl (com.adaptris.core.jms.JmsPollingConsumerImpl)1 PasConsumer (com.adaptris.core.jms.PasConsumer)1 PtpPollingConsumer (com.adaptris.core.jms.PtpPollingConsumer)1 PtpProducer (com.adaptris.core.jms.PtpProducer)1 MockMessageListener (com.adaptris.core.stubs.MockMessageListener)1 Test (org.junit.Test)1