-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat(core): default error handler #648
feat(core): default error handler #648
Conversation
...l-k-core/support/src/main/java/org/apache/camel/k/listener/GlobalErrorHandlerConfigurer.java
Outdated
Show resolved
Hide resolved
...l-k-core/support/src/main/java/org/apache/camel/k/listener/GlobalErrorHandlerConfigurer.java
Outdated
Show resolved
Hide resolved
Adding a new configurer that will look for a camel.k.global-error-handler property that can be used to set a default global error handler. Any route builder will inherit this error handler unless it is explicitly specified.
* Introduced a new SourceType, errorHandler, that can be used as a source for spotting a default error handler that will be used in those routes that don't specify any * Forced the sources sorting in order to load errorHandler first, sources and templates * Added a check to make sure only one error handler is provided
3266051
to
00121eb
Compare
camel-k-core/support/src/main/java/org/apache/camel/k/listener/SourcesConfigurer.java
Outdated
Show resolved
Hide resolved
a2ac53a
to
d3236de
Compare
camel-k-core/support/src/main/java/org/apache/camel/k/support/SourcesSupport.java
Outdated
Show resolved
Hide resolved
d3236de
to
088c3cd
Compare
return; | ||
} | ||
// We must ensure the source order as defined in SourceType enum | ||
Arrays.sort(sources, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think getType
should never return null
so maybe we should add some validation and then this can maybe simplified with something like:
Arrays.sort(source, Comparator.comparing(SourceDefinition::getType))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I had to introduce those checks because there were a few unit test failing and also the real integration. I think the root cause may be within camel k which leaves that field blank. However, it will need a bit more of investigation. Are you okey if I open a follow up issue and we keep this ahead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
I've changed a little bit the first commit in order to avoid re-loading the source. Adding a new SourceType and make it load the very first will allow Camel K operator to specify the
error-handler
Kamelet just once.Release Note