The source code for this example is available on GitHub: https://github.com/travisdazell/camel-throttler
Let's consider an integration scenario where we receive orders via an incoming file drop. We then pick up the file, process it with some custom Java code, and then place a message on a JMS queue. Here's the Camel route, with a throttler that only allows one message to be sent to the JMS queue every five seconds.
<camelcontext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="file://incoming" /> <to uri="bean:orderProcessor?method=processIncomingOrder" /> <throttle timePeriodMillis="5000"> <constant>1</constant> <to uri="activemq:queue:ORDERS.INCOMING" /> </throttle> </route> </camelcontext>
No comments:
Post a Comment