Search in sources :

Example 81 with ConnectionFactory

use of javax.jms.ConnectionFactory in project camel by apache.

the class JmsRequestReplyReplyToOverrideTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    JmsComponent jmsComponent = jmsComponentAutoAcknowledge(connectionFactory);
    jmsComponent.getConfiguration().setReplyTo("baz");
    jmsComponent.getConfiguration().setReplyToOverride("bar");
    camelContext.addComponent("jms", jmsComponent);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ConnectionFactory(javax.jms.ConnectionFactory)

Example 82 with ConnectionFactory

use of javax.jms.ConnectionFactory in project camel by apache.

the class JmsRequestReplySharedReplyToTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory));
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ConnectionFactory(javax.jms.ConnectionFactory)

Example 83 with ConnectionFactory

use of javax.jms.ConnectionFactory in project camel by apache.

the class JmsRouteRequestReplyTest method init.

protected static void init() {
    if (inited.compareAndSet(false, true)) {
        ContextBuilder contextBuilderMessageID = new ContextBuilderMessageID();
        ContextBuilder contextBuilderCorrelationID = new ContextBuilder() {

            public CamelContext buildContext(CamelContext context) throws Exception {
                ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
                ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
                jmsComponent.setConnectionFactory(connectionFactory);
                jmsComponent.setUseMessageIDAsCorrelationID(false);
                jmsComponent.setConcurrentConsumers(maxServerTasks);
                context.addComponent(componentName, jmsComponent);
                return context;
            }
        };
        ContextBuilder contextBuilderMessageIDNamedReplyToSelector = new ContextBuilder() {

            public CamelContext buildContext(CamelContext context) throws Exception {
                ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
                ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
                jmsComponent.setConnectionFactory(connectionFactory);
                jmsComponent.setUseMessageIDAsCorrelationID(true);
                jmsComponent.setConcurrentConsumers(maxServerTasks);
                jmsComponent.getConfiguration().setReplyToDestinationSelectorName(REPLY_TO_DESTINATION_SELECTOR_NAME);
                context.addComponent(componentName, jmsComponent);
                return context;
            }
        };
        ContextBuilder contextBuilderCorrelationIDNamedReplyToSelector = new ContextBuilder() {

            public CamelContext buildContext(CamelContext context) throws Exception {
                ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
                ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
                jmsComponent.setConnectionFactory(connectionFactory);
                jmsComponent.setUseMessageIDAsCorrelationID(false);
                jmsComponent.setConcurrentConsumers(maxServerTasks);
                jmsComponent.getConfiguration().setReplyToDestinationSelectorName(REPLY_TO_DESTINATION_SELECTOR_NAME);
                context.addComponent(componentName, jmsComponent);
                return context;
            }
        };
        ContextBuilder contextBuilderCorrelationIDDiffComp = new ContextBuilder() {

            public CamelContext buildContext(CamelContext context) throws Exception {
                ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
                ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
                jmsComponent.setConnectionFactory(connectionFactory);
                jmsComponent.setConcurrentConsumers(maxServerTasks);
                context.addComponent(componentName, jmsComponent);
                ActiveMQComponent jmsComponent1 = ActiveMQComponent.activeMQComponent();
                jmsComponent1.setConnectionFactory(connectionFactory);
                jmsComponent1.setUseMessageIDAsCorrelationID(false);
                jmsComponent1.setConcurrentConsumers(maxServerTasks);
                context.addComponent(componentName1, jmsComponent1);
                return context;
            }
        };
        ContextBuilder contextBuilderMessageIDDiffComp = new ContextBuilder() {

            public CamelContext buildContext(CamelContext context) throws Exception {
                ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
                ActiveMQComponent jmsComponent = ActiveMQComponent.activeMQComponent();
                jmsComponent.setConnectionFactory(connectionFactory);
                jmsComponent.setUseMessageIDAsCorrelationID(true);
                jmsComponent.setConcurrentConsumers(maxServerTasks);
                context.addComponent(componentName, jmsComponent);
                ActiveMQComponent jmsComponent1 = ActiveMQComponent.activeMQComponent();
                jmsComponent1.setConnectionFactory(connectionFactory);
                jmsComponent1.setUseMessageIDAsCorrelationID(true);
                jmsComponent1.setConcurrentConsumers(maxServerTasks);
                context.addComponent(componentName1, jmsComponent1);
                return context;
            }
        };
        contextBuilders.put("testUseMessageIDAsCorrelationID", contextBuilderMessageID);
        contextBuilders.put("testUseCorrelationID", contextBuilderCorrelationID);
        contextBuilders.put("testUseMessageIDAsCorrelationIDMultiNode", contextBuilderMessageID);
        contextBuilders.put("testUseCorrelationIDMultiNode", contextBuilderCorrelationID);
        contextBuilders.put("testUseMessageIDAsCorrelationIDPersistReplyToMultiNode", contextBuilderMessageID);
        contextBuilders.put("testUseCorrelationIDPersistReplyToMultiNode", contextBuilderCorrelationID);
        contextBuilders.put("testUseMessageIDAsCorrelationIDPersistMultiReplyToMultiNode", contextBuilderMessageID);
        // contextBuilders.put("testUseCorrelationIDPersistMultiReplyToMultiNode", contextBuilderCorrelationID);
        contextBuilders.put("testUseMessageIDAsCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode", contextBuilderMessageIDNamedReplyToSelector);
        contextBuilders.put("testUseCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode", contextBuilderCorrelationIDNamedReplyToSelector);
        contextBuilders.put("testUseCorrelationIDMultiNodeDiffComponents", contextBuilderCorrelationIDDiffComp);
        contextBuilders.put("testUseMessageIDAsCorrelationIDMultiNodeDiffComponents", contextBuilderMessageIDDiffComp);
        contextBuilders.put("testUseMessageIDAsCorrelationIDTimeout", contextBuilderMessageID);
        contextBuilders.put("testUseCorrelationIDTimeout", contextBuilderMessageID);
        routeBuilders.put("testUseMessageIDAsCorrelationID", new SingleNodeRouteBuilder());
        routeBuilders.put("testUseMessageIDAsCorrelationIDReplyToTempDestinationPerComponent", new SingleNodeRouteBuilder());
        routeBuilders.put("testUseMessageIDAsCorrelationIDReplyToTempDestinationPerProducer", new SingleNodeRouteBuilder());
        routeBuilders.put("testUseCorrelationID", new SingleNodeRouteBuilder());
        routeBuilders.put("testUseMessageIDAsCorrelationIDMultiNode", new MultiNodeRouteBuilder());
        routeBuilders.put("testUseCorrelationIDMultiNode", new MultiNodeRouteBuilder());
        routeBuilders.put("testUseMessageIDAsCorrelationIDPersistReplyToMultiNode", new MultiNodeRouteBuilder());
        routeBuilders.put("testUseCorrelationIDPersistReplyToMultiNode", new MultiNodeRouteBuilder());
        routeBuilders.put("testUseMessageIDAsCorrelationIDPersistMultiReplyToMultiNode", new MultiNodeReplyToRouteBuilder());
        // routeBuilders.put("testUseCorrelationIDPersistMultiReplyToMultiNode", new MultiNodeReplyToRouteBuilder());
        routeBuilders.put("testUseMessageIDAsCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode", new MultiNodeReplyToRouteBuilder());
        routeBuilders.put("testUseCorrelationIDPersistMultiReplyToWithNamedSelectorMultiNode", new MultiNodeReplyToRouteBuilder());
        routeBuilders.put("testUseCorrelationIDMultiNodeDiffComponents", new MultiNodeDiffCompRouteBuilder());
        routeBuilders.put("testUseMessageIDAsCorrelationIDMultiNodeDiffComponents", new MultiNodeDiffCompRouteBuilder());
        routeBuilders.put("testUseMessageIDAsCorrelationIDTimeout", new SingleNodeDeadEndRouteBuilder());
        routeBuilders.put("testUseCorrelationIDTimeout", new SingleNodeDeadEndRouteBuilder());
    }
}
Also used : CamelContext(org.apache.camel.CamelContext) ConnectionFactory(javax.jms.ConnectionFactory) ActiveMQComponent(org.apache.activemq.camel.component.ActiveMQComponent)

Example 84 with ConnectionFactory

use of javax.jms.ConnectionFactory in project camel by apache.

the class JmsRouteTimeoutCheckerIntervalTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    JmsComponent activmq = jmsComponentAutoAcknowledge(connectionFactory);
    // check 4 times per second
    activmq.setRequestTimeoutCheckerInterval(250);
    camelContext.addComponent("activemq", activmq);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ConnectionFactory(javax.jms.ConnectionFactory)

Example 85 with ConnectionFactory

use of javax.jms.ConnectionFactory in project camel by apache.

the class JmsSimpleRequestCustomReplyToTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
    camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory));
    JmsComponent jms = camelContext.getComponent("activemq", JmsComponent.class);
    // as this is a unit test I dont want to wait 20 sec before timeout occurs, so we use 10
    jms.getConfiguration().setRequestTimeout(10000);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ConnectionFactory(javax.jms.ConnectionFactory)

Aggregations

ConnectionFactory (javax.jms.ConnectionFactory)620 Connection (javax.jms.Connection)237 CamelContext (org.apache.camel.CamelContext)220 Session (javax.jms.Session)193 TextMessage (javax.jms.TextMessage)148 MessageConsumer (javax.jms.MessageConsumer)143 MessageProducer (javax.jms.MessageProducer)142 Test (org.junit.Test)128 JMSException (javax.jms.JMSException)106 InitialContext (javax.naming.InitialContext)106 Destination (javax.jms.Destination)93 Queue (javax.jms.Queue)91 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)80 ActiveMQConnectionFactory (org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory)61 Message (javax.jms.Message)56 Context (javax.naming.Context)35 NamingException (javax.naming.NamingException)33 QueueConnectionFactory (javax.jms.QueueConnectionFactory)31 TopicConnectionFactory (javax.jms.TopicConnectionFactory)31 Topic (javax.jms.Topic)29