spring-kafka
spring-kafka copied to clipboard
Optimize a `MessagingMessageListenerAdapter` returning `null` from the `DelegatingInvocableHandler.invoke()`
Right now the DelegatingInvocableHandler.invoke() always returns an InvocationResult even if result == null.
In the end we may just have a log message like:
Async result is null, ignoring
which is not always true for the regular void @KafkaHandler method.
Changing the logic in the mention method to:
if (result != null) {
return new InvocationResult(result, this.handlerSendTo.get(handler),
this.handlerReturnsMessage.get(handler));
}
else {
return null;
}
would make some optimization where we would not try to resolve any reply attempts and creation of many interim objects like CompletableFuture.
Since this would be a breaking change, the issue is scheduled for the next 4.0 major version.
Hi, @artembilan!
Could I work on this issue?
Thanks!
@ivamly Yes, please go ahead.
See the comment on the latest PR. https://github.com/spring-projects/spring-kafka/pull/3710#issuecomment-2597068984
I'll make another PR soon, no problem.