GH-9705: AbstractReplyProducingMessageHandler: check for logging enabled

Fixes: #9705
Issue link: https://github.com/spring-projects/spring-integration/issues/9705

Currently when any class that implements `AbstractReplyProducingMessageHandler` doesn't produce a reply it will log the message, even if no reply is required.
The message should only be logged if `isLoggingEnabled()` returns true as a handler that doesn't require a reply may be a normal operation that is expected, and if we've set `loggingEnabled` to false it shouldn't log the message.

* Prevent logging when no reply is provided for an `AbstractReplyProducingMessageHandler` if logging is disabled

(cherry picked from commit 7fc104ac8b)
This commit is contained in:
Mitchell
2024-12-11 04:02:21 +13:00
committed by Spring Builds
parent a10814d1e2
commit 1071c3c082

View File

@@ -154,7 +154,7 @@ public abstract class AbstractReplyProducingMessageHandler extends AbstractMessa
throw new ReplyRequiredException(message, "No reply produced by handler '" +
getComponentName() + "', and its 'requiresReply' property is set to true.");
}
else if (!isAsync()) {
else if (!isAsync() && isLoggingEnabled()) {
logger.debug(LogMessage.format("handler '%s' produced no reply for request Message: %s", this, message));
}
}