-
Notifications
You must be signed in to change notification settings - Fork 1.1k
INT-3459: Log exceptions in case of failOver #2790
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
Conversation
catch (Exception ex) { | ||
RuntimeException runtimeException = | ||
IntegrationUtils.wrapInDeliveryExceptionIfNecessary(message, | ||
() -> "Dispatcher failed to deliver Message", ex); |
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.
Why this line wrap? It was previously 112.
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.
Well, my own preferences: I find it is much readable when variable initialization is multi-line. So, I start initialization block fully from a new line.
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.
OK
boolean isLast = !handlerIterator.hasNext(); | ||
if (!isLast && this.failover && this.logger.isInfoEnabled()) { | ||
this.logger.info("An exception thrown from the '" + handler + "' for the '" + message + "'. " + | ||
"Will be in a failover for the next subscriber.", ex); |
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.
Sorry for my language, but the two the
should be removed.
this.logger.info("An exception was thrown by '" + handler + "' for while handling '" + message + "'. " +
"Failing over to the next subscriber.", ex);
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.
Perhaps only include full stack trace at DEBUG and ex.getMessage()
at INFO?
@@ -137,18 +137,24 @@ private boolean doDispatch(Message<?> message) { | |||
if (!handlerIterator.hasNext()) { | |||
throw new MessageDispatchingException(message, "Dispatcher has no subscribers"); | |||
} | |||
List<RuntimeException> exceptions = new ArrayList<RuntimeException>(); | |||
List<RuntimeException> exceptions = new ArrayList<>(); |
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.
We should create this array lazily because it's only used in error situations. 99.9999% not used.
JIRA: https://jira.spring.io/browse/INT-3459 When `UnicastingDispatcher` is configured with `failOver` (true by default), it loses exceptions it caught with previous handler when the next one processes message properly * Add INFO logging for exceptions which are caught before going to fail over to the next handler
} | ||
else if (this.logger.isDebugEnabled()) { | ||
this.logger.debug("An exception was thrown by '" + handler + "' while handling '" + message + | ||
"'. Failing over to the next subscriber.", ex); |
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.
Debug has to be detected first otherwise we'll always take the INFO branch.
* Add a note about this logging into the `channel.adoc`
JIRA: https://jira.spring.io/browse/INT-3459
When
UnicastingDispatcher
is configured withfailOver
(true by default),it loses exceptions it caught with previous handler when the next one
processes message properly
over to the next handler