Hello Camel community,

Official docs are saying that Supervising Route Controller tries to start 
"failed" routes again, but actually it is starting routes that are "stopped". 
You can find that code in class DefaultSupervisingRouteController, method 
startSupervisedRoutes(). There is line of code which does routes filtering by 
checking status "Stopped", but I think it should check for status Failed 
instead.

There is a bad experience which I have in my case, here I will describe how is 
this happening on my project and what I am doing:

In our project in one of our special cases we have to put some routes in status 
SUSPEND and we have to do that before the routes are even started within 
CamelContext. We have implemented CamelContextConfiguration class and we get 2 
CamelContext lifecycle methods. So in lifecycle method afterApplicationStart() 
we get some routes and suspend them. We can't do this with Default Route 
Controller because it is too late, routes are somehow already started. That is 
too late for us, we need to suspend them before they are started! And this is 
really how we need to do that because of our business logic, we cannot use 
anything from options on the route (for example .noAutoStartup()).

So because of that Default Route Controller deficiency we use Supervising Route 
Controller instead, which has stated in official docs: "A supervising capable 
RouteController that delays the startup of the routes after the camel context 
startup and takes control of starting the routes in a safe manner."
And this is ok, it works very well and as expected!

Then we are able to do the suspension, but not on all routes. For example route 
with Kafka consumer is not suspendable, and when you try to suspend components 
which can't be suspended, they are actually put to STOP status. And here is one 
sentence from your official java doc from interface RouteController, for method 
suspendRoute(String id): "If the route does not support suspension the route 
will be stopped instead".

After this my kafka route will be in status STOPED (which is still ok for us), 
but after that, there comes DefaultSupervisingRouteController and finds that as 
"failed" (which is not), and will start it again. So final conclusion and 
questions is that if I use Supervising Controller, I am not able to suspend or 
stop some components because they will actually be started again?
Why it is like that? Is that a bug or is it meant to be like that?
Even if you planned to be like that, then it is a bad experience for us, 
because you simply cannot stop/suspend routes when using Supervising Route 
Controller.

We are using Camel 3.15 and camel-kafka-starter.

Very interested into topic and happy to hear explanation.
Kind Regards,
Nikola Glidzic




Reply via email to