- configure an embedded local Messaging Broker
<!-- This creates an embedded ActiveMQ Broker -->
<broker xmlns="http://activemq.apache.org/schema/core" useJmx="true" persistent="false">
<transportConnectors>
<transportConnector uri="tcp://localhost:61616" />
</transportConnectors>
</broker>
<!-- Lets connect the Camel ActiveMQ component to the embedded broker.
See http://camel.apache.org/activemq.html for more information.
-->
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="failover:tcp://localhost:61616"/>
</bean>
- configure an inMemory (JVM) Messaging Broker
<!-- Configure an inVM ActiveMQ Broker for test purposes -->
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="brokerURL" value="vm://localhost?broker.persistent=false"/>
</bean>
- a sample Camel route using the
activemq
component endpoint
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="file:src/data?noop=true"/>
<to uri="activemq:personnel.records"/>
</route>
<route>
<from uri="activemq:personnel.records"/>
<choice>
<when>
<xpath>/person/city = 'London'</xpath>
<to uri="file:target/messages/uk"/>
</when>
<otherwise>
<to uri="file:target/messages/others"/>
</otherwise>
</choice>
</route>
</camelContext>
to use the ActiveMQ Messagin Broker in you Camel Project you have to add the following maven dep: