Search in sources :

Example 11 with BasicActiveMqImplementation

use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.

the class PtpProducerTest method retrieveSampleConfig.

private StandaloneProducer retrieveSampleConfig() {
    JmsConnection c = configureForExamples(new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:61616")));
    c.setClientId(null);
    StandaloneProducer result = new StandaloneProducer(c, configureForExamples(new PtpProducer().withQueue("SampleQ1")));
    return result;
}
Also used : BasicActiveMqImplementation(com.adaptris.core.jms.activemq.BasicActiveMqImplementation) StandaloneProducer(com.adaptris.core.StandaloneProducer)

Example 12 with BasicActiveMqImplementation

use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.

the class PasConsumerTest method testDurable_WithSubscriptionId.

@Test
public void testDurable_WithSubscriptionId() throws Exception {
    new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:16161"));
    PasConsumer pas = new PasConsumer();
    pas.setTopic("destination");
    assertFalse(pas.durable());
    pas.setSubscriptionId("MySubscriptionId");
    assertTrue(pas.durable());
}
Also used : BasicActiveMqImplementation(com.adaptris.core.jms.activemq.BasicActiveMqImplementation) Test(org.junit.Test)

Example 13 with BasicActiveMqImplementation

use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.

the class PasConsumerTest method retrieveSampleConfig.

protected StandaloneConsumer retrieveSampleConfig() {
    JmsConnection c = new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:16161"));
    PasConsumer pc = new PasConsumer();
    pc.setTopic("destination");
    NullCorrelationIdSource mcs = new NullCorrelationIdSource();
    pc.setCorrelationIdSource(mcs);
    c.setConnectionErrorHandler(new JmsConnectionErrorHandler());
    pc.setSubscriptionId("subscription-id");
    StandaloneConsumer result = new StandaloneConsumer();
    result.setConnection(c);
    result.setConsumer(pc);
    return result;
}
Also used : BasicActiveMqImplementation(com.adaptris.core.jms.activemq.BasicActiveMqImplementation) StandaloneConsumer(com.adaptris.core.StandaloneConsumer)

Example 14 with BasicActiveMqImplementation

use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.

the class RequestReplyWorkflowTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Channel c = new Channel();
    try {
        c.setConsumeConnection(new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:61616")));
        c.setProduceConnection(new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:2506")));
        RequestReplyWorkflow workflow = new RequestReplyWorkflow();
        workflow.getServiceCollection().addService(new Base64DecodeService());
        workflow.setConsumer(new PtpConsumer().withQueue("inputQueue"));
        workflow.setProducer(new PtpProducer().withQueue("outputQueue"));
        workflow.setReplyProducer(new PtpProducer().withQueue("TODO"));
        workflow.getReplyServiceCollection().addService(new Base64EncodeService());
        c.getWorkflowList().add(workflow);
        c.setUniqueId(UUID.randomUUID().toString());
        workflow.setUniqueId(UUID.randomUUID().toString());
    } catch (CoreException e) {
        throw new RuntimeException(e);
    }
    return c;
}
Also used : PtpConsumer(com.adaptris.core.jms.PtpConsumer) Base64EncodeService(com.adaptris.core.services.Base64EncodeService) BasicActiveMqImplementation(com.adaptris.core.jms.activemq.BasicActiveMqImplementation) MockChannel(com.adaptris.core.stubs.MockChannel) Base64DecodeService(com.adaptris.core.services.Base64DecodeService) JmsConnection(com.adaptris.core.jms.JmsConnection) PtpProducer(com.adaptris.core.jms.PtpProducer)

Example 15 with BasicActiveMqImplementation

use of com.adaptris.core.jms.activemq.BasicActiveMqImplementation in project interlok by adaptris.

the class AdapterTest method createRetryingAdapter.

/**
 * <p>
 * Creates a valid Adapter to use in tests. Uese Mock aka Memory MessageConsumer / Producer.
 * </p>
 *
 * @param uniqueId a uniqure identifier for this <code>Adapter</code>
 */
public static Adapter createRetryingAdapter(String uniqueId) throws Exception {
    Adapter result = null;
    AdaptrisConnection consume = new NullConnection();
    JmsConnection produce = new JmsConnection(new BasicActiveMqImplementation("tcp://localhost:5000"));
    produce.setConnectionRetryInterval(new TimeInterval(1L, TimeUnit.SECONDS.name()));
    produce.setConnectionAttempts(20);
    AdaptrisMessageProducer producer1 = new PtpProducer().withQueue("dummyQueue");
    StandardWorkflow workflow1 = new StandardWorkflow();
    workflow1.setProducer(producer1);
    WorkflowList workflows = new WorkflowList();
    workflows.add(workflow1);
    Channel channel = new Channel();
    channel.setUniqueId(uniqueId + "_c1");
    channel.setConsumeConnection(consume);
    channel.setProduceConnection(produce);
    channel.setWorkflowList(workflows);
    ChannelList channels = new ChannelList();
    channels.addChannel(channel);
    result = new Adapter();
    result.setChannelList(channels);
    result.setUniqueId(uniqueId);
    return result;
}
Also used : BasicActiveMqImplementation(com.adaptris.core.jms.activemq.BasicActiveMqImplementation) TimeInterval(com.adaptris.util.TimeInterval) JmsConnection(com.adaptris.core.jms.JmsConnection) PtpProducer(com.adaptris.core.jms.PtpProducer)

Aggregations

BasicActiveMqImplementation (com.adaptris.core.jms.activemq.BasicActiveMqImplementation)24 Test (org.junit.Test)9 StandaloneConsumer (com.adaptris.core.StandaloneConsumer)7 TimeInterval (com.adaptris.util.TimeInterval)7 StandaloneProducer (com.adaptris.core.StandaloneProducer)5 ArrayList (java.util.ArrayList)4 MockChannel (com.adaptris.core.stubs.MockChannel)3 AdaptrisComponent (com.adaptris.core.AdaptrisComponent)2 Channel (com.adaptris.core.Channel)2 CoreException (com.adaptris.core.CoreException)2 JmsConnection (com.adaptris.core.jms.JmsConnection)2 PtpProducer (com.adaptris.core.jms.PtpProducer)2 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)1 DefaultMessageFactory (com.adaptris.core.DefaultMessageFactory)1 PtpConsumer (com.adaptris.core.jms.PtpConsumer)1 Base64DecodeService (com.adaptris.core.services.Base64DecodeService)1 Base64EncodeService (com.adaptris.core.services.Base64EncodeService)1 ReplaceWithFirstMessage (com.adaptris.core.services.aggregator.ReplaceWithFirstMessage)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1