Debug not resolved channel in Router

Currently, when `!resolutionRequired` not resolved channel name
is ignored silently, and we go ahead to `defaultOutputChannel` or
exception thrown

* For better end-user experience `DEBUG` not resolved and ignored channel name if `!resolutionRequired`
This commit is contained in:
abilan
2023-01-13 15:12:44 -05:00
parent d298df8d0f
commit fc3b95ea79

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -309,9 +309,12 @@ public abstract class AbstractMappingMessageRouter extends AbstractMessageRouter
try {
channel = getChannelResolver().resolveDestination(channelName);
}
catch (DestinationResolutionException e) {
catch (DestinationResolutionException ex) {
if (this.resolutionRequired) {
throw new MessagingException(message, "failed to resolve channel name '" + channelName + "'", e);
throw new MessagingException(message, "Failed to resolve a channel for name '" + channelName + "'", ex);
}
else {
logger.debug(() -> "Failed to resolve a channel for name '" + channelName + "'. Ignored");
}
}
return channel;
@@ -397,7 +400,7 @@ public abstract class AbstractMappingMessageRouter extends AbstractMessageRouter
}
}
else {
throw new MessagingException("unsupported return type for router [" + channelKey.getClass() + "]");
throw new MessagingException("Unsupported return type for router [" + channelKey.getClass() + "]");
}
}