Interface FlowRegulator

All Known Implementing Classes:
NoOpFlowRegulator

public interface FlowRegulator
Interface for controlling flow regulation in a consumer. Implementations of this interface can dictate whether the consumer should pause fetching or consuming messages, and for how long. This is useful in scenarios where controlling message consumption rate ensures better system performance or resource utilization.
  • Method Summary

    Modifier and Type
    Method
    Description
    Optionally pause this consumer for a given amount of time.
  • Method Details

    • pauseDuration

      default Optional<Duration> pauseDuration()
      Optionally pause this consumer for a given amount of time. During this time the consumer will not fetch or consume any messages.

      After the given pause duration, this method will be called again to determine if fetching should continue or be paused for longer – i.e., the consumer will not continue until this method returns an empty optional.