SampleConsumer (Apache JMeter dist API)
Description: declaration: package: org.apache.jmeter.report.processor, interface: SampleConsumer

Package org.apache.jmeter.report.processor

# Interface SampleConsumer

All Superinterfaces:
  `SampleProcessor`

All Known Implementing Classes:
  `AbstractGraphConsumer`, `AbstractOverTimeGraphConsumer`, `AbstractSampleConsumer`, `AbstractSummaryConsumer`, `AbstractVersusRequestsGraphConsumer`, `ActiveThreadsGraphConsumer`, `AggregateConsumer`, `ApdexSummaryConsumer`, `BytesThroughputGraphConsumer`, `CodesPerSecondGraphConsumer`, `ConnectTimeOverTimeGraphConsumer`, `CustomGraphConsumer`, `ErrorsSummaryConsumer`, `ExternalSampleSorter`, `FilterConsumer`, `HitsPerSecondGraphConsumer`, `LatencyOverTimeGraphConsumer`, `LatencyVSRequestGraphConsumer`, `NormalizerSampleConsumer`, `RequestsSummaryConsumer`, `ResponseCustomGraphGraphConsumer`, `ResponseTimeDistributionGraphConsumer`, `ResponseTimeOverTimeGraphConsumer`, `ResponseTimePercentilesGraphConsumer`, `ResponseTimePercentilesOverTimeGraphConsumer`, `ResponseTimePerSampleGraphConsumer`, `ResponseTimeVSRequestGraphConsumer`, `SampleWriterConsumer`, `StatisticsSummaryConsumer`, `SyntheticResponseTimeDistributionGraphConsumer`, `TaggerConsumer`, `TimeVSThreadGraphConsumer`, `Top5ErrorsBySamplerConsumer`, `TotalTPSGraphConsumer`, `TransactionsPerSecondGraphConsumer`

public interface SampleConsumer extends SampleProcessor
Defines a sample consumer

A sample consumer is meant to consume samples in order to process them.

A sample consumer can consume samples on different channels and each channel is assigned a single metadata structure.

A sample consumer is passive, meaning that its `consume()` service must be called by a third party object.

Sample metadata must be provided to the consumer before `startConsuming()` is called.

The following sequence must be observed when consuming samples :

- Call `setConsumedMetadata()` for each channel that will consume samples
- Call `startConsuming()` before any call to `consume()`
- Call `consume()` for each sample to be consumed by the consumer, specify the channel on which to consume
- Call `stopConsuming()` after every sample has been consumed

Since:
  3.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `consume(Sample s, int channel)`
  Consumes the specified sample ton the specified channel.
  `void`
  `setConsumedMetadata(SampleMetadata sampleMetadata, int channel)`
  Set the metadata of samples that will be consumed on the specified channel.
  `void`
  `startConsuming()`
  Start the sample consuming.
  `void`
  `stopConsuming()`
  Stops the consuming process.

  ### Methods inherited from interface org.apache.jmeter.report.processor.SampleProcessor

  `getChannelAttribute, getSampleContext, setChannelAttribute, setSampleContext`

- ## Method Details

  - ### setConsumedMetadata

    void setConsumedMetadata(SampleMetadata sampleMetadata, int channel)
    Set the metadata of samples that will be consumed on the specified channel.
    Parameters:
      `sampleMetadata` - The sample metadata that are being consumed for the associated channel
      `channel` - The channel whose sample metadata are being defined

  - ### startConsuming

    void startConsuming()
    Start the sample consuming. This step is used by consumer to initialize their process.

  - ### consume

    void consume(Sample s, int channel)
    Consumes the specified sample ton the specified channel.
    Parameters:
      `s` - The sample to be consumed
      `channel` - The channel on which the sample is consumed

  - ### stopConsuming

    void stopConsuming()
    Stops the consuming process. No sample will be processed after this service has been called.