- 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 -
Method Summary
Modifier and TypeMethodDescriptionapply(DemandPacer.Request previousRequest, long observedItemsCount) Evaluate the next request after the previous request delay has expired.initial()Get the initial request.
-
Method Details
-
initial
DemandPacer.Request initial()Get the initial request.This will be called at the
Multi.paceDemand()operator subscription time.- Returns:
- the request, must not be
null
-
apply
Evaluate the next request after the previous request delay has expired.- Parameters:
previousRequest- the previous requestobservedItemsCount- the number of emitted items that have been observed since the last request- Returns:
- the request, must not be
null
-