-
- 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 voidcomplete(T item)Emits theitemevent downstream with the given (potentiallynull) item.voidfail(java.lang.Throwable failure)Emits thefailureevent downstream with the given exception.UniEmitter<T>onTermination(java.lang.Runnable onTermination)Attaches a @{code termination} event handler invoked when the downstreamUniSubscriptionis cancelled, or when the emitter has emitted either anitemorfailureevent.-
Methods inherited from interface io.smallrye.mutiny.subscription.ContextSupport
context
-
-
-
-
Method Detail
-
complete
void complete(T item)
Emits theitemevent 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 thefailureevent 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 downstreamUniSubscriptionis cancelled, or when the emitter has emitted either anitemorfailureevent.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
-
-