use of com.adaptris.core.jms.PtpPollingConsumer 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.PtpPollingConsumer in project interlok by adaptris.
the class ActiveMqPtpPollingConsumerTest method createConsumer.
private StandaloneConsumer createConsumer(EmbeddedActiveMq broker, String threadName, String destinationName) throws Exception {
PtpPollingConsumer consumer = new PtpPollingConsumer().withQueue(destinationName);
consumer.setPoller(new FixedIntervalPoller(new TimeInterval(500L, TimeUnit.MILLISECONDS)));
JmsConnection c = broker.getJmsConnection();
consumer.setClientId(c.configuredClientId());
consumer.setUserName(c.configuredUserName());
consumer.setPassword(c.configuredPassword());
consumer.setReacquireLockBetweenMessages(true);
consumer.setVendorImplementation(c.getVendorImplementation());
StandaloneConsumer sc = new StandaloneConsumer(consumer);
return sc;
}
Aggregations