'Kafka tombstone throws exception in spring cloud stream kafka batch consumer

I have a functional batch consumer that throws the following exception when receivcing a tombstone message:

No serializer found for class org.springframework.kafka.support.KafkaNull and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)

The @Bean method has this signature:

public Consumer<Message<List<MyEntity>>> myConsumer()

and the configuration contains the property batch-mode=true

If I disable the batch mode and change the consumer accordingly (Consumer<Message<MyEntity>>) the tombstone message is handled properly with a KafkaNull payload.



Sources

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

Source: Stack Overflow

Solution Source