Interface DemandPacer

All Known Implementing Classes:
FixedDemandPacer

public interface DemandPacer
Interface for Multi demand pacers and the Multi.paceDemand() operator.

A demand-pacer allows controlling upstream demand using a request and a delay. Each time the delay expires the pacer can evaluate a new demand based on the previous request and the number of emitted items that have been observed since the previous request.

The FixedDemandPacer offers a fixed delay / fixed demand implementation, but custom / adaptive strategies can be provided through this DemandPacer interface.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    A demand request.
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(DemandPacer.Request previousRequest, long observedItemsCount)
    Evaluate the next request after the previous request delay has expired.
    Get the initial request.
  • Method Details

    • initial

      Get the initial request.

      This will be called at the Multi.paceDemand() operator subscription time.

      Returns:
      the request, must not be null
    • apply

      DemandPacer.Request apply(DemandPacer.Request previousRequest, long observedItemsCount)
      Evaluate the next request after the previous request delay has expired.
      Parameters:
      previousRequest - the previous request
      observedItemsCount - the number of emitted items that have been observed since the last request
      Returns:
      the request, must not be null