-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ErrorHandler for stopping a route when an error occurs #2724
Comments
Also what would be needed is that the error would be stored into the route last error, so that it integrates nicely with #2719, and the error message be reported into the integration / binding status. |
@nicolaferraro you can use |
I am not familiar with the
or we can include a new parameter to the
In that case we should change also something on the came-k-runtime (more or less here) About the routes names we use, maybe this snippet can be helpful:
Basically we control the names of the routes for the |
Yeah, I like the Kamelet approach for the error handler. It may also be useful to add additional behavior, such as setting the last error as @astefanutti was mentioning. The action, such as "stop" or "ignore" could be part of the Kamelet itself. |
Another ticket to allow to control Camel to auto stop un-healthy routes |
@davsclaus I see that the lastError on the route is not set when an exception is thrown in an exchange. Is that something linked to health-check only? |
its 2 different things
|
Ok, btw let's give the main route a name, since when using the Kamelet strategy we're basically switching to another route, so we need a way to stop the main one. For the "lastError" field, @astefanutti I'm not sure it's the right place to put the reason why we stopped a route in case of exchange error, since as @davsclaus was saying, it contains lifecycle errors that were throws while trying to change the state of a route (starting, stopping, ..) |
While currently the "last error" concept is only implemented for route lifecycle operations, my understanding is that it's generic and not limited to route lifecycle: Intuitively, when the decision is taken to stop a route because an error during the processing of an exchange occurred, I would expect the error details to be reported as well in the health check result, as an explanation of the |
I was trying to implement the "stop route" behavior when encountering an error in a KameletBinding and it looks I can use a
controlbus
to implement it.Something like:
Even if the concept of
dead-letter-channel
is a bit stretched here, that should do the work.The only problem is that error handlers in Camel do not use dynamic dispatch and so the
${routeId}
placeholder is not resolved. Everything works when providing the right route ID.Since bindings have a single main route, I wonder if we can simply call it e.g.
binding
in order to use a URI likecontrolbus:route?routeId=binding&action=stop
.@davsclaus you're the master, do you see another way?
cc: @squakez
The text was updated successfully, but these errors were encountered: