0

Inside a Camel route, I need to throttle the messages when a limit of request/s is reached. I've found the Throttler EIP. It works fine but I need when the limit is reached to raise an alert, is there a way to do this ?

I had a look at the code but don't found a way to extend it.

Thanks & Regards

melmass
  • 21
  • 1

1 Answers1

0

This is not possible to know out of the box. You would need to extend it, or build your own throttler.

I logged a ticket so we can expose in JMX the number of messages currently hold-back throttler: https://issues.apache.org/jira/browse/CAMEL-6670

If your altering tooling can react on JMX then they can react if the jmx attribute > 0 and send an email etc.

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65
  • Ok thanks for the quick response. But If I extend it, how can I invoke it inside my camel route knowing that I'm using the DSL format ? – melmass Aug 26 '13 at 15:42
  • I mean replace **from().throttle(100).to()** by **from().mythrottle(100).to()** – melmass Aug 26 '13 at 15:50
  • All EIPs in Camel is a Processor. So you can extend the code and use a .process in the DSL, eg from XX process(new MyThrottler(100)).to YY – Claus Ibsen Aug 26 '13 at 17:05
  • Ok thank you Claus. In fact I was already aware of this kind of invocation. The problem is that I had a look at the **ThrottlerDefinition** class and it seems that it does not use the default constructor to instanciate it. So I don't know how to pass all the needed input to the Throttler such as the context and so on ... I hope I was clear enough :-) – melmass Aug 27 '13 at 07:19