T - the value type emittedpublic interface MonoSink<T>
| Modifier and Type | Method and Description |
|---|---|
default ContextView |
contextView()
Return the current subscriber's context as a
ContextView for inspection. |
Context |
currentContext()
Deprecated.
To be removed in 3.6.0 at the earliest. Prefer using #contextView() instead.
|
void |
error(Throwable e)
Terminate with the given exception
|
MonoSink<T> |
onCancel(Disposable d)
Attach a
Disposable as a callback for when this MonoSink is
cancelled. |
MonoSink<T> |
onDispose(Disposable d)
Attach a
Disposable as a callback for when this MonoSink is effectively
disposed, that is it cannot be used anymore. |
MonoSink<T> |
onRequest(LongConsumer consumer)
Attaches a
LongConsumer to this MonoSink that will be notified of
any request to this sink. |
void |
success()
Complete without any value.
|
void |
success(T value)
Complete this
Mono with the given value. |
void success()
Calling this method multiple times or after the other terminating methods has no effect.
void success(@Nullable T value)
Mono with the given value.
Calling this method multiple times or after the other
terminating methods has no effect (the value is dropped).
Calling this method with a null value will be silently accepted as a call to
success() by standard implementations.
value - the value to complete withvoid error(Throwable e)
Calling this method multiple times or after the other terminating methods is
an unsupported operation. It will discard the exception through the
Hooks.onErrorDropped(Consumer) hook. This is to avoid
complete and silent swallowing of the exception.
e - the exception to complete with@Deprecated Context currentContext()
Context.
Context can be enriched via Mono.contextWrite(Function)
operator or directly by a child subscriber overriding
CoreSubscriber.currentContext()
default ContextView contextView()
ContextView for inspection.
Context can be enriched downstream via Mono.contextWrite(Function)
operator or directly by a child subscriber overriding CoreSubscriber.currentContext().
ContextView.MonoSink<T> onRequest(LongConsumer consumer)
LongConsumer to this MonoSink that will be notified of
any request to this sink.consumer - the consumer to invoke on requestMonoSink with a consumer that is notified of requestsMonoSink<T> onCancel(Disposable d)
Disposable as a callback for when this MonoSink is
cancelled. At most one callback can be registered, and subsequent calls to this method
will result in the immediate disposal of the extraneous Disposable.
The callback is only relevant when the downstream Subscription is cancelled.
d - the Disposable to use as a callbackMonoSink with a cancellation callbackonDispose(Disposable) for a callback that covers cancellation AND terminal signalsMonoSink<T> onDispose(Disposable d)
Disposable as a callback for when this MonoSink is effectively
disposed, that is it cannot be used anymore. This includes both having played terminal
signals (onComplete, onError) and having been cancelled (see onCancel(Disposable)).
At most one callback can be registered, and subsequent calls to this method will result in
the immediate disposal of the extraneous Disposable.
Note that the "dispose" term is used from the perspective of the sink. Not to
be confused with Mono.subscribe()'s Disposable.dispose() method, which
maps to disposing the Subscription (effectively, a Subscription.cancel()
signal).
d - the Disposable to use as a callbackMonoSink with a callback invoked on any terminal signal or on cancellationonCancel(Disposable) for a cancellation-only callback