Skip to content

Instantly share code, notes, and snippets.

@rajdavies
Created September 6, 2013 19:57
Show Gist options
  • Save rajdavies/6469107 to your computer and use it in GitHub Desktop.
Save rajdavies/6469107 to your computer and use it in GitHub Desktop.
Use a broker camel component to re-route messages when the queue size reaches a 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment