-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
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), the header is only available in the record interceptor but it would certainly make sense to also have it in when using a batch interceptor.
The internal headers are currently added in KafkaMessageListenerContainer#internalHeaders but this method is only called for single record listeners (see KafkaMessageListenerContainer#checkEarlyIntercept).
Batches are handled in KafkaMessageListenerContainer#invokeBatchListener. So, the interceptor could be called after having iterated on the list of records to allow adding the info header.