Вопрос

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?

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top