T
- the value typepublic interface FluxSink<T>
Modifier and Type | Interface and Description |
---|---|
static class |
FluxSink.OverflowStrategy
Enumeration for backpressure handling.
|
Modifier and Type | Method and Description |
---|---|
void |
complete() |
Context |
currentContext()
Return the current subscriber
Context . |
void |
error(Throwable e) |
boolean |
isCancelled()
Returns true if the downstream cancelled the sequence.
|
FluxSink<T> |
next(T t)
Try emitting, might throw an unchecked exception.
|
FluxSink<T> |
onCancel(Disposable d)
Associates a disposable resource with this FluxSink
that will be disposed in case the downstream cancels the sequence
via
Subscription.cancel() . |
FluxSink<T> |
onDispose(Disposable d)
Associates a disposable resource with this FluxSink
that will be disposed on the first terminate signal which may be
a cancel, complete or error signal.
|
FluxSink<T> |
onRequest(LongConsumer consumer)
Attaches a
LongConsumer to this FluxSink that will be notified of
any request to this sink. |
long |
requestedFromDownstream()
The current outstanding request amount.
|
void complete()
Subscriber.onComplete()
Context currentContext()
Context
.
Context
can be enriched via Flux.subscriberContext(Function)
operator or directly by a child subscriber overriding
CoreSubscriber.currentContext()
Context
.void error(Throwable e)
e
- the exception to signal, not nullSubscriber.onError(Throwable)
FluxSink<T> next(T t)
t
- the value to emit, not nullSubscriber.onNext(Object)
long requestedFromDownstream()
boolean isCancelled()
FluxSink<T> onRequest(LongConsumer consumer)
LongConsumer
to this FluxSink
that will be notified of
any request to this sink.
For push/pull sinks created using Flux.create(java.util.function.Consumer)
or Flux.create(java.util.function.Consumer, FluxSink.OverflowStrategy)
,
the consumer
is invoked for every request to enable a hybrid backpressure-enabled push/pull model.
When bridging with asynchronous listener-based APIs, the onRequest
callback
may be used to request more data from source if required and to manage backpressure
by delivering data to sink only when requests are pending.
For push-only sinks created using Flux.push(java.util.function.Consumer)
or Flux.push(java.util.function.Consumer, FluxSink.OverflowStrategy)
,
the consumer is invoked with an initial request of Long.MAX_VALUE
when this method
is invoked.
consumer
- the consumer to invoke on each requestFluxSink
with a consumer that is notified of requestsFluxSink<T> onCancel(Disposable d)
Subscription.cancel()
.d
- the disposable callback to useFluxSink
with resource to be disposed on cancel signalFluxSink<T> onDispose(Disposable d)
d
- the disposable callback to useFluxSink
with resource to be disposed on first terminate signal