...
You can include a camel.xml file into your ActiveMQ broker config and then if you want to take all messages sent to a Queue Topic and publish them to a TopicQueue, changing their priority along the way - you can do something like this:
Code Block |
<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>
|
...
There are some extra classes that have been added to the activemq-broker package - to enable views of the running broker without using JMX - and to support the use of the broker component:
MessageBrokerView - which provides methods to retrieve statistics on a the broker, and from the MessageBrokerView - you can retrieve a BrokerDestinationView for a particular destination. This means you can add flexible routing inside the broker by doing something like the following - to route messages when a destination's queue depth reaches a certain limit:
Code Block |
<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>
|
...