Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing warning in batch listener: No batch message converter is set. because record message converter is null. #3687

Closed
tom-mi opened this issue Dec 16, 2024 · 1 comment
Milestone

Comments

@tom-mi
Copy link

tom-mi commented Dec 16, 2024

In what version(s) of Spring for Apache Kafka are you seeing this issue?

3.3.0 (possibly earlier versions as well, but we noticed only recently after our usual spring boot upgrades)

Describe the bug

When using the @KafkaListener annotation with batch=true annotating a method with a ConusmerRecords<String,String> parameter, the following warning is logged:

[Test worker] WARN  o.s.k.l.a.BatchMessagingMessageListenerAdapter - No batch message converter is set. because record message converter is null. 

even though the listener works perfectly fine (and our setup follows standard guides how to set up such a batch listener).

I don't have enough insights into spring kafka to understand if we are doing something (slightly? completely?) wrong or if this is just a false positive.
However, our logs are currently polluted with that warning, distracting from real issues.

Please explain or fix.

(it seems this was added in this commit: 78d7724)

To Reproduce

  • Use @KafkaListener annotation with batch="true", annotating a method like this: fun listen(records: ConsumerRecords<String, String>)

Expected behavior

No warning is logged.

Sample

https://github.com/tom-mi/demo-2024-12-16-spring-kafka-warning

@artembilan
Copy link
Member

I think we have to revert that warning.
The MessagingMessageListenerAdapter uses a MessagingMessageConverter by default.
And that is totally enough for the logic where BatchMessageConverter comes without recordConverter.

Feel free to contribute the fix: https://github.com/spring-projects/spring-kafka/blob/main/CONTRIBUTING.adoc!
But quickly because we are releasing today 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants