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;
}
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;
}
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);
}
Aggregations