BlueprintCamelContext can not add an ActiveMQComponent using non-default name in RouteBuilder.configure() method

Solution Verified - Updated -

Issue

I have a simple Camel Blueprint bundle that uses Java DSL and adds an ActiveMQComponent to registry using non-default name (for instance "test-jms" rather than default name "activemq") within RouteBuilder.configure() method:

public class TestRouteBuilder extends RouteBuilder {
    private static final Logger LOG = LoggerFactory.getLogger(TestRouteBuilder.class);

    public void configure() {
        try {
            ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
            connectionFactory.setBrokerURL("tcp://localhost:61616");
            connectionFactory.setUserName("admin");
            connectionFactory.setPassword("admin");

            PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory();
            pooledConnectionFactory.setConnectionFactory(connectionFactory);

            JmsConfiguration jmsConfiguration = new JmsConfiguration();
            jmsConfiguration.setConnectionFactory(pooledConnectionFactory);
            jmsConfiguration.setAcknowledgementModeName("AUTO_ACKNOWLEDGE");
            JmsComponent jmsComponent = new JmsComponent(jmsConfiguration);

            getContext().addComponent("test-jms", jmsComponent);
        } catch (Exception e) {
            LOG.error("caught an exception when starting camel context!");
        }

        from("test-jms:queue:test")
        .to("file:data/output/");

    }
}

However, it does not work. Instead, it's just stuck on trying to resolve the "test-jms" component:

19:35:16,933 | INFO  | l Console Thread | BlueprintContainerImpl           | 9 - org.apache.aries.blueprint.core - 1.0.1.redhat-610379 | Bundle simple-camel-blueprint-bundle.1.0 is waiting for dependencies [(&(component=test-jms)(objectClass=org.apache.camel.spi.ComponentResolver))]

Environment

  • JBoss Fuse
    • 6.2.1
    • 6.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.