Search code examples
filterspring-kafkareactivereactor-kafka

Is there a way to filter kafka record before deserialization when using reactor kafka


I'm consuming messages from kafka using reactor-kafka and spring-kafka, all in a spring-boot application. I'm trying to filter records, based on some headers , before deserialization. currently I have a solution by using a customAvroDeserializer.

is there any chance I can use RecordFilterStrategy to do this ?


Solution

  • No; RecordFilterStrategy is only available in spring-kafka (Spring for Apache Kafka).

    In any case, that is only applied after deserialization.

    You could use a custom deserializer that returns null (or some other special value) in the record.value() but you would still need to filter those in your reactor pipeline.