You can implement a RoutePolicy which you can specify when setting up the route. It has callbacks for onStart, onStop, onResume, onSuspend, onInit, onRemove, onExchangeBegin, onExchangeDone
Adding a processor to the lifecycle of a route in Apache Camel
-
23-07-2023 - |
Question
I would like to add my processor to the lifecycle of a route (or context) and be able to start and stop things when the route starts and stops. I don't really want to create a component for this. I have been researching and I found out I can implement Service
and I can add my service to the context.
However, the only way I find to add it to the context is through the Exchange
. Is there any other cleaner way of doing this?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow