Skip to content

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

@tom-mi

Description

@tom-mi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions