Broker Camel ComponentAvailable as of ActiveMQ 5.9 Embedding Apache Camel inside the ActiveMQ broker provides great flexibility for extending the message broker with the integration power of Camel. Apache Camel routes also benefit in that you can avoid the serialization and network costs of connecting to ActiveMQ remotely - if you use the activemq component. If however, you want to change the behavior of messages flowing through the ActiveMQ message broker itself you will be limited to the shipped set of ActiveMQ broker Interceptors - or develop your own Broker plugin and then introduce that as a jar on to the class path for the ActiveMQ broker. The For example by defining a CamelContext to run inside the broker's JVM the <route id="setPriority"> <from uri="broker:topic:test.broker.>"/> <setHeader headerName="JMSPriority"> <constant>9</constant> </setHeader> <to uri="broker:queue:test.broker.component.queue"/> </route> Notes:
There is one deliberate caveat though, only intercepted messages can be sent to a Extra classes that have been added to the
ExampleHow to route messages when a destination's queue depth has reached a certain limit: <camelContext id="camel" trace="false" xmlns="http://camel.apache.org/schema/spring"> <route id="routeAboveQueueLimitTest"> <from uri="broker:queue:test.broker.queue"/> <choice> <when> <spel>#{@destinationView.queueSize >= 100}</spel> <to uri="broker:queue:test.broker.processLater"/> </when> <otherwise> <to uri="broker:queue:test.broker.queue"/> </otherwise> </choice> </route> </camelContext> <bean id="brokerView" class="org.apache.activemq.broker.view.MessageBrokerView"> <constructor-arg value="testBroker"/> </bean> <bean id="destinationView" factory-bean="brokerView" factory-method="getDestinationView"> <constructor-arg value="test.broker.component.route"/> </bean> This is using the Camel Message Router pattern. Note the use of the Spring expression language
|