- Type Parameters:
T- the expected type of items.
- All Superinterfaces:
ContextSupport
-
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Emits acompletionevent downstream indicating that no more item will be sent.Emits anitemevent downstream.voidEmits afailureevent downstream with the given exception.booleandefault MultiEmitter<T> onCancellation(Runnable onCancellation) Defines a callback forFlow.Subscription.cancel()signals.default MultiEmitter<T> onRequest(LongConsumer consumer) Defines a callback forFlow.Subscription.request(long)signals.onTermination(Runnable onTermination) Attaches a @{code termination} event handler invoked when the downstreamFlow.Subscriptionis cancelled, or when the emitter has emitted either acompletionorfailureevent.longMethods inherited from interface io.smallrye.mutiny.subscription.ContextSupport
context
-
Method Details
-
emit
Emits anitemevent downstream.Calling this method after a failure or a completion events has no effect.
- Parameters:
item- the item, must not benull- Returns:
- this emitter, so firing item events can be chained.
-
fail
Emits afailureevent downstream with the given exception.Calling this method multiple times or after the
complete()method has no effect.- Parameters:
failure- the exception, must not benull
-
complete
void complete()Emits acompletionevent downstream indicating that no more item will be sent.Calling this method multiple times or after the
fail(Throwable)method has no effect. -
onTermination
Attaches a @{code termination} event handler invoked when the downstreamFlow.Subscriptionis cancelled, or when the emitter has emitted either acompletionorfailureevent.This method allows cleanup resources once the emitter can be disposed (has reached a terminal state).
If the registration of the
onTerminationcallback is done after the termination, it invokes the callback immediately.- Parameters:
onTermination- the action to run on termination, must not benull- Returns:
- this emitter
-
isCancelled
boolean isCancelled()- Returns:
trueif the downstream cancelled the stream or the emitter was terminated (with a completion or failure events).
-
requested
long requested()- Returns:
- the current outstanding request amount.
-
onRequest
Defines a callback forFlow.Subscription.request(long)signals.This is useful to facilitate the implementation of back-pressured emissions.
- Parameters:
consumer- the callback- Returns:
- this emitter
-
onCancellation
Defines a callback forFlow.Subscription.cancel()signals.This is useful to facilitate the implementation of cancellation logic.
- Parameters:
onCancellation- the callback- Returns:
- this emitter
-