Package org.apache.activemq.camel.component

Examples of org.apache.activemq.camel.component.ActiveMQComponent


      if (camelContext == null) {
        LOG.debug("Creating camel context");
        camelContext = new DefaultCamelContext();
        ActiveMQConfiguration conf = new ActiveMQConfiguration();
        conf.setConnectionFactory(new PooledConnectionFactory((ActiveMQConnectionFactory)factory));
        ActiveMQComponent component = new ActiveMQComponent(conf);
        camelContext.addComponent("activemq", component);
      }
      return camelContext;
    }
View Full Code Here


    @Override
    protected Context createJndiContext() throws Exception {
        JndiContext answer = new JndiContext();

        // add ActiveMQ with embedded broker
        ActiveMQComponent amq = ActiveMQComponent.activeMQComponent("vm://localhost?broker.persistent=false");
        amq.setCamelContext(context);
        answer.bind("jms", amq);
        return answer;
    }
View Full Code Here

        return new ClassPathXmlApplicationContext("org/apache/activemq/camel/ActiveMQComponentFactoryUserNamePassword.xml");
    }

    @Test
    public void testActiveMQ() throws Exception {
        ActiveMQComponent comp = context.getComponent("activemq", ActiveMQComponent.class);
        assertNotNull(comp);

        ActiveMQConfiguration config = (ActiveMQConfiguration) comp.getConfiguration();
        assertNotNull(config);
        assertEquals("admin2", config.getUserName());
        assertEquals("secret2", config.getPassword());

        getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
View Full Code Here

                "jms.redeliveryPolicy.initialRedeliveryDelay=500&" +
                "jms.useAsyncSend=false&jms.sendTimeout=ABC&" +
                "jms.maxXXXXReconnectAttempts=1&jms.timeout=3000";

            LOG.info("creating context with bad URI: " + vmUri);
            ActiveMQComponent amq = ActiveMQComponent.activeMQComponent(vmUri);

            amq.getConfiguration().getConnectionFactory();

            fail("Should have received an exception from the bad URI.");
        } catch(Exception e) {
            // Expected
        }
View Full Code Here

            final String vmUri = "vm://localhost?" +
                "broker.XXX=foo&broker.persistent=XXX&broker.useJmx=false";

            LOG.info("creating context with bad URI: " + vmUri);
            ActiveMQComponent amq = ActiveMQComponent.activeMQComponent(vmUri);

            camelContext = new DefaultCamelContext();
            camelContext.addComponent("activemq", amq);
            final String queueEndpointName = "activemq:queuetest.Queue";
            camelContext.addRoutes(new RouteBuilder() {
View Full Code Here

        return new ClassPathXmlApplicationContext("org/apache/activemq/camel/ActiveMQComponentUserNamePassword.xml");
    }

    @Test
    public void testActiveMQ() throws Exception {
        ActiveMQComponent comp = context.getComponent("activemq", ActiveMQComponent.class);
        assertNotNull(comp);

        ActiveMQConfiguration config = (ActiveMQConfiguration) comp.getConfiguration();
        assertNotNull(config);
        assertEquals("admin", config.getUserName());
        assertEquals("secret", config.getPassword());

        getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
View Full Code Here

            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;
                }
            };
View Full Code Here

    @Override
    protected Context createJndiContext() throws Exception {
        JndiContext answer = new JndiContext();

        // add ActiveMQ with embedded broker
        ActiveMQComponent amq = ActiveMQComponent.activeMQComponent("vm://localhost?broker.persistent=false");
        amq.setCamelContext(context);
        answer.bind("jms", amq);
        return answer;
    }
View Full Code Here

    @Override
    protected Context createJndiContext() throws Exception {
        JndiContext answer = new JndiContext();

        // add ActiveMQ with embedded broker
        ActiveMQComponent amq = ActiveMQComponent.activeMQComponent("vm://localhost?broker.persistent=false");
        amq.setCamelContext(context);
        answer.bind("jms", amq);
        return answer;
    }
View Full Code Here

    @Override
    protected Context createJndiContext() throws Exception {
        JndiContext answer = new JndiContext();

        // add ActiveMQ with embedded broker
        ActiveMQComponent amq = ActiveMQComponent.activeMQComponent("vm://localhost?broker.persistent=false");
        amq.setCamelContext(context);
        answer.bind("jms", amq);
        return answer;
    }
View Full Code Here

TOP

Related Classes of org.apache.activemq.camel.component.ActiveMQComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.