You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by David Karlsen <da...@gmail.com> on 2015/10/22 13:23:05 UTC

Advice needed - throttling jms producing

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

Re: Advice needed - throttling jms producing

Posted by yogu13 <yo...@gmail.com>.
Done something similar in past, We prefered writing a camel processor and
placed the blocking logic within it. 



--
View this message in context: http://camel.465427.n5.nabble.com/Advice-needed-throttling-jms-producing-tp5772967p5773056.html
Sent from the Camel - Users mailing list archive at Nabble.com.