Skip to content

The listener info header is not added when using a batch listener #2249

@frosiere

Description

@frosiere

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions