Search in sources :

Example 1 with JmsPollingConsumerImpl

use of com.adaptris.core.jms.JmsPollingConsumerImpl 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)

Aggregations

FixedIntervalPoller (com.adaptris.core.FixedIntervalPoller)1 JmsConnection (com.adaptris.core.jms.JmsConnection)1 JmsPollingConsumerImpl (com.adaptris.core.jms.JmsPollingConsumerImpl)1 JmsTransactedWorkflow (com.adaptris.core.jms.JmsTransactedWorkflow)1 PtpPollingConsumer (com.adaptris.core.jms.PtpPollingConsumer)1 TextMessageTranslator (com.adaptris.core.jms.TextMessageTranslator)1 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)1 TimeInterval (com.adaptris.util.TimeInterval)1