Example usage for org.springframework.kafka.listener.adapter RecordFilterStrategy RecordFilterStrategy

List of usage examples for org.springframework.kafka.listener.adapter RecordFilterStrategy RecordFilterStrategy

Introduction

In this page you can find the example usage for org.springframework.kafka.listener.adapter RecordFilterStrategy RecordFilterStrategy.

Prototype

RecordFilterStrategy

Source Link

Usage

From source file:org.s1p.CommonConfiguration.java

@Bean
public ConcurrentKafkaListenerContainerFactory<String, String> retryKafkaListenerContainerFactory() {
    ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>();
    factory.setConsumerFactory(consumerFactory());
    factory.setRetryTemplate(new RetryTemplate());
    factory.setRecordFilterStrategy(new RecordFilterStrategy<String, String>() {

        @Override//from  ww  w . java2  s  .c om
        public boolean filter(ConsumerRecord<String, String> consumerRecord) {
            return consumerRecord.value().equals("bar");
        }

    });
    return factory;
}