Pergunta

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?

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top