Search in sources :

Example 1 with PtpPollingConsumer

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;
}
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 2 with PtpPollingConsumer

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;
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) PtpPollingConsumer(com.adaptris.core.jms.PtpPollingConsumer) JmsConnection(com.adaptris.core.jms.JmsConnection) FixedIntervalPoller(com.adaptris.core.FixedIntervalPoller) StandaloneConsumer(com.adaptris.core.StandaloneConsumer)

Aggregations

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