-
- Type Parameters:
T
- the expected type of items.
- All Superinterfaces:
ContextSupport
public interface MultiEmitter<T> extends ContextSupport
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
complete()
Emits acompletion
event downstream indicating that no more item will be sent.MultiEmitter<T>
emit(T item)
Emits anitem
event downstream.void
fail(java.lang.Throwable failure)
Emits afailure
event downstream with the given exception.boolean
isCancelled()
MultiEmitter<T>
onTermination(java.lang.Runnable onTermination)
Attaches a @{code termination} event handler invoked when the downstreamFlow.Subscription
is cancelled, or when the emitter has emitted either acompletion
orfailure
event.long
requested()
-
Methods inherited from interface io.smallrye.mutiny.subscription.ContextSupport
context
-
-
-
-
Method Detail
-
emit
MultiEmitter<T> emit(T item)
Emits anitem
event 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
void fail(java.lang.Throwable failure)
Emits afailure
event 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 acompletion
event downstream indicating that no more item will be sent.Calling this method multiple times or after the
fail(Throwable)
method has no effect.
-
onTermination
MultiEmitter<T> onTermination(java.lang.Runnable onTermination)
Attaches a @{code termination} event handler invoked when the downstreamFlow.Subscription
is cancelled, or when the emitter has emitted either acompletion
orfailure
event.This method allows cleanup resources once the emitter can be disposed (has reached a terminal state).
If the registration of the
onTermination
callback 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:
true
if 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.
-
-