apache-camelactivemq-classicamq

ActiveMQ with Camel basics


I already googled for a while looking for step by step tutorials explaining setup and integration of ActiveMQ with Camel, but had little success to find a basic tutorial. I already have a running and configured ActiveMQ server but I just can't get the Camel Component up and running. It always creates a separate broker and I just can't make Camel connect to the existing broker instance.

Any hints where I can find basic tutorials on how to integrate Camel and develop a better understanding on how those two work together? Please do not refere to Camel-Website, as this along with the docs for ActiveMQ where my primary source to fight through the stuff, but it helped only a little on setup, configuration and through understanding of both packages.

Thanks


Solution

  • Following is configuration of Active MQ with camel.

    <bean id="jmsConnectionFactory"
              class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="tcp://localhost:61616"/>
        </bean>
    
        <bean id="pooledConnectionFactory"
              class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
            <property name="maxConnections" value="8"/>
            <property name="connectionFactory" ref="jmsConnectionFactory"/>
        </bean>
    
        <bean id="jmsConfig"
              class="org.apache.camel.component.jms.JmsConfiguration">
            <property name="connectionFactory" ref="pooledConnectionFactory"/>
            <property name="concurrentConsumers" value="10"/>
        </bean>
        <bean id="activemq"
              class="org.apache.activemq.camel.component.ActiveMQComponent">
            <property name="configuration" ref="jmsConfig"/>
        </bean>
        <camelContext xmlns="http://camel.apache.org/schema/spring">
    
    <route id="*****">
                <from uri="+++++++++" />
                <choice>
                        <to uri="activemq:queue:**********"/>
                                </choice>
            </route>
        </camelContext>