Skip to content

Commit

Permalink
spring-projectsGH-3697: Optimize a MessagingMessageListenerAdapter re…
Browse files Browse the repository at this point in the history
…turning null from the DelegatingInvocableHandler.invoke()

Signed-off-by: ivamly <[email protected]>
  • Loading branch information
ivamly committed Jan 16, 2025
1 parent 5f7b151 commit 10a2609
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public boolean isAsyncReplies() {
* @throws Exception raised if no suitable argument resolver can be found,
* or the method raised an exception.
*/
@Nullable
public Object invoke(Message<?> message, Object... providedArgs) throws Exception { //NOSONAR
Class<?> payloadClass = message.getPayload().getClass();
InvocableHandlerMethod handler = getHandlerForPayload(payloadClass);
Expand All @@ -186,8 +187,12 @@ public Object invoke(Message<?> message, Object... providedArgs) throws Exceptio
else {
result = handler.invoke(message, providedArgs);
}
Expression replyTo = this.handlerSendTo.get(handler);
return new InvocationResult(result, replyTo, this.handlerReturnsMessage.get(handler));
if (result != null) {
Expression replyTo = this.handlerSendTo.get(handler);
return new InvocationResult(result, replyTo, this.handlerReturnsMessage.get(handler));
} else {
return null;
}
}

/**
Expand Down

0 comments on commit 10a2609

Please sign in to comment.