Class FilterConsumer

All Implemented Interfaces:
SampleConsumer, SampleProcessor, SampleProducer

public class FilterConsumer extends AbstractSampleConsumer

The class FilterConsumer provides a way to discard samples in a consumer chain. This class uses a predicate for the filtering decision.

  • When reverseFilter is false, samples are discarded if none predicate is defined or samples don't match the predicate.
  • When reverseFilter is true, samples are discarded if a predicate is defined and samples match the predicate.
  • Constructor Details

    • FilterConsumer

      public FilterConsumer()
  • Method Details

    • isReverseFilter

      public final boolean isReverseFilter()
      Checks if the filtering is reversed.
      true if the filtering is reversed; otherwise false.
    • setReverseFilter

      public final void setReverseFilter(boolean reverseFilter)
      Reverses the filtering decision.
      reverseFilter - the filter mode to set
    • getSamplePredicate

      public final SamplePredicate getSamplePredicate()
      Gets the sample predicate used to filter the samples.
      the sample predicate used to filter the samples.
    • setSamplePredicate

      public final void setSamplePredicate(SamplePredicate samplePredicate)
      Sets the sample predicate used to filter the samples.
      samplePredicate - the new sample predicate.
    • startConsuming

      public void startConsuming()
      Description copied from interface: SampleConsumer
      Start the sample consuming. This step is used by consumer to initialize their process.
    • consume

      public void consume(Sample sample, int channel)
      Description copied from interface: SampleConsumer
      Consumes the specified sample ton the specified channel.
      sample - The sample to be consumed
      channel - The channel on which the sample is consumed
    • stopConsuming

      public void stopConsuming()
      Description copied from interface: SampleConsumer
      Stops the consuming process. No sample will be processed after this service has been called.