Skip to content

Spring Kafka doesn't returns null for Tombstone records during batch processing #974

@filipkokorevs

Description

@filipkokorevs

@Payload(required = false) is a great thing during consuming of records that might be eventually Tombstone. But it does not work in a batch processing. Here is an example that does throw ClassCastException once Tombstone record received:

@KafkaListener(topics = ["\${kafka.topic.categories}"])
fun receive(
   @Header(KafkaHeaders.RECEIVED_MESSAGE_KEY) List<String> keys,
   @Payload(required = false) categories: List<Category>
) {
    ...
}

This is especially inconvenient with records represented by JSON, as you have to write additional workarounds to achieve the required functionality. Would be great to avoid any workarounds inside a business code by having support of @Payload as part of a batch processing inside of Spring FW.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions