Question

I have a Camel Route Definition written in Java DSL like this:

from(myEndpoint) 
.throttle(200)
.to(myOtherEndpoint);

This connects my two endpoints using a Throttler which limits the message flow to 200 messages per second.

I'm looking for a way to change the maximumRequestCount / second during runtime. So I need to somehow get to the Throttler instance which is called and change the property.

How can I access the Throttler?

Was it helpful?

Solution

Ok, I figured it out by myself ...

You need to define your Throttler instance yourself.

Throttler throttler = new Throttler(null, 200);

Then you can use it in your routes like this, because Throttler implements the Processor interface:

from(myEndpoint) 
.process(throttler)
.to(myOtherEndpoint);

Any time you like you can change the properties of the throttler.

OTHER TIPS

Yeah that is a neat solution.

In Camel 2.0 you can now navigate the runtime processors in the route and thus find any Throttlers and then be able to change it dynamically.

But we are also working on improving the JMX in Camel 2.1 so you can change throttler/delayer and the likes from JMX.

And maybe also improve the Navigate API so you can find in a one liner, eg maybe lookup by id if you provide an id in the route. Or by types so you can filter and only get the Throttlers etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top