Usecase: I have a route which ends with sending to a jms queue. OutOnly - no req/res.
In order to avoid producing too fast I want to throttle the production rate based on queue depth (or ratio of max queue depth). I have api's to query the queuedepth. I've been looking at http://camel.apache.org/throttler.html which seems most suitable. I can implement the maximumRequestsPerPeriod as a custom expression which queries the messaging subsystem, and thus return a number of messages "left" (e.g. maxdepth-currentdepth). I can further optimize this a bit by caching the counting to every n-th invocation or timewindow of 10 sec or so (so I don't query the mom for each and every message -> overhead). However it's not possible to "block entirely" by returning 0. Of course I'm pretty close if returning 1 - which is probably a situation we'll never get into anyway - as long as the consumer of messages of the queue is in fact alive and able to process. Anybody else done this? Seems like common usecase. Should it be possible to return 0 in the expression and thereby block the route completely? -- -- David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen