Interface RecordFilterStrategy<K,​V>

  • Type Parameters:
    K - the key type.
    V - the value type.

    public interface RecordFilterStrategy<K,​V>
    Implementations of this interface can signal that a record about to be delivered to a message listener should be discarded instead of being delivered.
    Author:
    Gary Russell
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean filter​(org.apache.kafka.clients.consumer.ConsumerRecord<K,​V> consumerRecord)
      Return true if the record should be discarded.
      default java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>> filterBatch​(java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>> records)
      Filter an entire batch of records; to filter all records, return an empty list, not null.
    • Method Detail

      • filter

        boolean filter​(org.apache.kafka.clients.consumer.ConsumerRecord<K,​V> consumerRecord)
        Return true if the record should be discarded.
        Parameters:
        consumerRecord - the record.
        Returns:
        true to discard.
      • filterBatch

        default java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>> filterBatch​(java.util.List<org.apache.kafka.clients.consumer.ConsumerRecord<K,​V>> records)
        Filter an entire batch of records; to filter all records, return an empty list, not null.
        Parameters:
        records - the records.
        Returns:
        the filtered records.
        Since:
        2.8