Interface MonoSink<T>
- Type Parameters:
T- the value type emitted
-
Method Summary
Modifier and TypeMethodDescriptiondefault ContextViewReturn the current subscriber's context as aContextViewfor inspection.Deprecated.To be removed in 3.6.0 at the earliest.voidTerminate with the given exceptionAttach aDisposableas a callback for when thisMonoSinkis cancelled.Attach aDisposableas a callback for when thisMonoSinkis effectively disposed, that is it cannot be used anymore.onRequest(LongConsumer consumer) Attaches aLongConsumerto thisMonoSinkthat will be notified of any request to this sink.voidsuccess()Complete without any value.voidComplete thisMonowith the given value.
-
Method Details
-
success
void success()Complete without any value.Calling this method multiple times or after the other terminating methods has no effect.
-
success
Complete thisMonowith 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 anullvalue will be silently accepted as a call tosuccess()by standard implementations.- Parameters:
value- the value to complete with
-
error
Terminate with the given exceptionCalling 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.- Parameters:
e- the exception to complete with
-
currentContext
Deprecated.To be removed in 3.6.0 at the earliest. Prefer using #contextView() instead.Return the current subscriberContext.Contextcan be enriched viaMono.contextWrite(Function)operator or directly by a child subscriber overridingCoreSubscriber.currentContext() -
contextView
Return the current subscriber's context as aContextViewfor inspection.Contextcan be enriched downstream viaMono.contextWrite(Function)operator or directly by a child subscriber overridingCoreSubscriber.currentContext().- Returns:
- the current subscriber
ContextView.
-
onRequest
Attaches aLongConsumerto thisMonoSinkthat will be notified of any request to this sink.- Parameters:
consumer- the consumer to invoke on request- Returns:
MonoSinkwith a consumer that is notified of requests
-
onCancel
Attach aDisposableas a callback for when thisMonoSinkis cancelled. At most one callback can be registered, and subsequent calls to this method will result in the immediate disposal of the extraneousDisposable.The callback is only relevant when the downstream
Subscriptioniscancelled.- Parameters:
d- theDisposableto use as a callback- Returns:
- the
MonoSinkwith a cancellation callback - See Also:
-
onDispose
Attach aDisposableas a callback for when thisMonoSinkis effectively disposed, that is it cannot be used anymore. This includes both having played terminal signals (onComplete, onError) and having been cancelled (seeonCancel(Disposable)). At most one callback can be registered, and subsequent calls to this method will result in the immediate disposal of the extraneousDisposable.Note that the "dispose" term is used from the perspective of the sink. Not to be confused with
Mono.subscribe()'sDisposable.dispose()method, which maps to disposing theSubscription(effectively, aSubscription.cancel()signal).- Parameters:
d- theDisposableto use as a callback- Returns:
- the
MonoSinkwith a callback invoked on any terminal signal or on cancellation - See Also:
-