Class FilteringBatchMessageListenerAdapter<K,V>

Type Parameters:
K - the key type.
V - the value type.
All Implemented Interfaces:
BatchAcknowledgingConsumerAwareMessageListener<K,V>, BatchMessageListener<K,V>, ConsumerSeekAware, DelegatingMessageListener<BatchMessageListener<K,V>>, GenericMessageListener<List<org.apache.kafka.clients.consumer.ConsumerRecord<K,V>>>

public class FilteringBatchMessageListenerAdapter<K,V> extends AbstractFilteringMessageListener<K,V,BatchMessageListener<K,V>> implements BatchAcknowledgingConsumerAwareMessageListener<K,V>
A BatchMessageListener adapter that implements filter logic via a RecordFilterStrategy.
  • Constructor Details

    • FilteringBatchMessageListenerAdapter

      public FilteringBatchMessageListenerAdapter(BatchMessageListener<K,V> delegate, RecordFilterStrategy<K,V> recordFilterStrategy)
      Create an instance with the supplied strategy and delegate listener.
      Parameters:
      delegate - the delegate.
      recordFilterStrategy - the filter.
    • FilteringBatchMessageListenerAdapter

      public FilteringBatchMessageListenerAdapter(BatchMessageListener<K,V> delegate, RecordFilterStrategy<K,V> recordFilterStrategy, boolean ackDiscarded)
      Create an instance with the supplied strategy and delegate listener. When 'ackDiscarded' is false, and all messages are filtered, an empty list is passed to the delegate (so it can decide whether or not to ack); when true, a completely filtered batch is ack'd by this class, and no call is made to the delegate.
      Parameters:
      delegate - the delegate.
      recordFilterStrategy - the filter.
      ackDiscarded - true to ack (commit offset for) discarded messages when the listener is configured for manual acks.
  • Method Details