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() |
void |
error(Throwable e) |
boolean |
isCancelled()
Returns true if the downstream cancelled the sequence.
|
void |
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.
|
FluxSink<T> |
serialize()
Deprecated.
Use
Flux.create(java.util.function.Consumer) or
Flux.create(java.util.function.Consumer, FluxSink.OverflowStrategy)
to create a serialized FluxSink . |
void |
setCancellation(Cancellation c)
Deprecated.
use
onDispose(Disposable) for resources to be disposed
on any cancel signal or onCancel(Disposable) for resources to be
disposed on cancel. |
void complete()
Subscriber.onComplete()
void error(Throwable e)
e
- the exception to signal, not nullSubscriber.onError(Throwable)
void next(T t)
t
- the value to emit, not null
Will return this sink from 3.1 (now void)Subscriber.onNext(Object)
long requestedFromDownstream()
boolean isCancelled()
@Deprecated FluxSink<T> serialize()
Flux.create(java.util.function.Consumer)
or
Flux.create(java.util.function.Consumer, FluxSink.OverflowStrategy)
to create a serialized FluxSink
.FluxSink
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, 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@Deprecated void setCancellation(Cancellation c)
onDispose(Disposable)
for resources to be disposed
on any cancel signal or onCancel(Disposable)
for resources to be
disposed on cancel.Subscription.cancel()
.c
- the cancellation callback to use