Skip to content

Commit fc3b95e

Browse files
committed
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`
1 parent d298df8 commit fc3b95e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

spring-integration-core/src/main/java/org/springframework/integration/router/AbstractMappingMessageRouter.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -309,9 +309,12 @@ private MessageChannel resolveChannelForName(String channelName, Message<?> mess
309309
try {
310310
channel = getChannelResolver().resolveDestination(channelName);
311311
}
312-
catch (DestinationResolutionException e) {
312+
catch (DestinationResolutionException ex) {
313313
if (this.resolutionRequired) {
314-
throw new MessagingException(message, "failed to resolve channel name '" + channelName + "'", e);
314+
throw new MessagingException(message, "Failed to resolve a channel for name '" + channelName + "'", ex);
315+
}
316+
else {
317+
logger.debug(() -> "Failed to resolve a channel for name '" + channelName + "'. Ignored");
315318
}
316319
}
317320
return channel;
@@ -397,7 +400,7 @@ else if (conversionService.canConvert(channelKey.getClass(), String.class)) {
397400
}
398401
}
399402
else {
400-
throw new MessagingException("unsupported return type for router [" + channelKey.getClass() + "]");
403+
throw new MessagingException("Unsupported return type for router [" + channelKey.getClass() + "]");
401404
}
402405
}
403406

0 commit comments

Comments
 (0)