Description
camel-jms should provide an async consumer that can throttle consumption of incoming messages. This is necessary in scenarios where a large backlog of messages exists on the input queue. In this case, it is likely that an async consumer will overload camel with message exchanges resulting in problems. A dynamic throttling mechanism on the async camel-jms consumer is required to avoid this problem.
One possible implementation might be as follows:
First, add a property "maxPendingAsyncExchanges" on the async camel-jms consumer endpoint. Then add support in the endpoint to track the total number of pending/in-progress exchanges, i.e., the number of exchanges for which no SUCCESS/ERROR acknowledgement has been returned. When this value reaches "maxPendingAsyncExchanges", then the endpoint would stop its Spring JMS DefaultMessageListenerContainer. Once the number of "pending" exchanges drops below a percentage of the "maxPendingAsyncExchanges" threshold, say "reconnectPercentOfMax", the Spring DMLC would be restarted.
The CXF implementation of this capability is described in CXF-2002, CXF-2342, and CXF-2391. CXF has properties maxSuspendedContinuations and reconnectPercentOfMax to control the throttling behavior.
This is the type of dynamic throttling I envisioned in Camel. Thoughts?
Attachments
Issue Links
- depends upon
-
CAMEL-1048 allow routes to easily be enabled/disabled based on an external predicate such as queue size
- Closed