Package io.smallrye.mutiny.subscription
Interface UniEmitter<T>
-
- Type Parameters:
T
- the expected type of item.
- All Superinterfaces:
ContextSupport
public interface UniEmitter<T> extends ContextSupport
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
complete(T item)
Emits theitem
event downstream with the given (potentiallynull
) item.void
fail(java.lang.Throwable failure)
Emits thefailure
event downstream with the given exception.UniEmitter<T>
onTermination(java.lang.Runnable onTermination)
Attaches a @{code termination} event handler invoked when the downstreamUniSubscription
is cancelled, or when the emitter has emitted either anitem
orfailure
event.-
Methods inherited from interface io.smallrye.mutiny.subscription.ContextSupport
context
-
-
-
-
Method Detail
-
complete
void complete(T item)
Emits theitem
event downstream with the given (potentiallynull
) item.Calling this method multiple times or after the
fail(Throwable)
method has no effect.- Parameters:
item
- the item, may benull
-
fail
void fail(java.lang.Throwable failure)
Emits thefailure
event downstream with the given exception.Calling this method multiple times or after the
complete(Object)
method has no effect.- Parameters:
failure
- the exception, must not benull
-
onTermination
UniEmitter<T> onTermination(java.lang.Runnable onTermination)
Attaches a @{code termination} event handler invoked when the downstreamUniSubscription
is cancelled, or when the emitter has emitted either anitem
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
-
-