Package io.smallrye.mutiny.subscription
Interface DemandPacer
-
- All Known Implementing Classes:
FixedDemandPacer
@Experimental("Demand pacing is a new experimental API introduced in Mutiny 1.5.0") public interface DemandPacerInterface forMultidemand pacers and theMulti.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
FixedDemandPaceroffers a fixed delay / fixed demand implementation, but custom / adaptive strategies can be provided through thisDemandPacerinterface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classDemandPacer.RequestA demand request.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DemandPacer.Requestapply(DemandPacer.Request previousRequest, long observedItemsCount)Evaluate the next request after the previous request delay has expired.DemandPacer.Requestinitial()Get the initial request.
-
-
-
Method Detail
-
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
DemandPacer.Request apply(DemandPacer.Request previousRequest, long observedItemsCount)
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
-
-