T
- Type of data processed by the Flowable
public final class BlockingBackpressureOperator<T> extends Object implements FlowableOperator<T,T>
Publisher
into a reactive stream. This is needed to interface
callback-based legacy code with back-pressure aware reactive-code.
To prevent overflow when a non back-pressure aware publisher emits items which have not requested by the subscriber,
the wrapped Subscriber
will be blocked before propagating the onNext()
invocation. To do so, each
Subscriber
is wrapped into a BlockingSubscriberWrapper
which will block the onNext()
caller
until the Subscriber
is ready to receive the item (Subscription.request(long)
).
Constructor and Description |
---|
BlockingBackpressureOperator(Duration timeout,
Supplier<Exception> timeoutExceptionSupplier)
Creates a new operator allowing to plug non back-pressure aware
Publisher to a Flowable chain. |
Modifier and Type | Method and Description |
---|---|
org.reactivestreams.Subscriber<? super T> |
apply(org.reactivestreams.Subscriber<? super T> subscriber) |
public BlockingBackpressureOperator(Duration timeout, Supplier<Exception> timeoutExceptionSupplier)
Publisher
to a Flowable
chain.
The transformer will block the emitter thread waiting until whether the receiver is ready to process the item or
the provided time-out expires in which case TimeoutException
will be propagated through onError().timeout
- Duration this transformer will wait for the receiver to be ready.timeoutExceptionSupplier
- supplier that will generate the exception to signal a timeoutCopyright 2010-2022 ForgeRock AS.