'The listener info header is not added when using a batch listener

The issue 2134 introduced a way to set arbitrary information using the info property of the KafkaListener annotation. This info is then added as a header on the ConsumerRecord.

When using a batch listener, this header is not added on the records.

Based on the documentation (https://docs.spring.io/spring-kafka/docs/current/reference/html/#li-header), I'm not sure it's a bug but it would certainly make sense to also make it available in batch interceptors?

The internal headers are currently added in KafkaMessageListenerContainer#internalHeaders but this method is only called for single record listeners (see KafkaMessageListenerContainer#checkEarlyIntercept).

Any feedback on this would be welcome.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source