T
- the value type emittedpublic interface MonoSink<T>
Modifier and Type | Method and Description |
---|---|
Context |
currentContext()
Return the current subscriber
Context . |
void |
error(Throwable e)
Terminate with the give 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 with the given value.
|
Context currentContext()
Context
.
Context
can be enriched via Mono.subscriberContext(Function)
operator or directly by a child subscriber overriding
CoreSubscriber.currentContext()
Context
.void success()
Calling this method multiple times or after the other terminating methods has no effect.
void success(@Nullable T value)
Calling this method multiple times or after the other
terminating methods has no effect (the value is purely ignored). 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 (which by default throws the exception
wrapped via Exceptions.bubble(Throwable)
). This is to avoid
complete and silent swallowing of the exception.
e
- the exception to complete withMonoSink<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. This happens only 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 signals
MonoSink<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)
).
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