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?

Was it helpful?

Solution

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

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