Interface UniEmitter<T>

Type Parameters:
T - the expected type of item.
All Superinterfaces:
ContextSupport

public interface UniEmitter<T> extends ContextSupport
An object allowing to send signals to the downstream Uni. Uni propagates a single item event, once the first is propagated, the others events have no effect.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    complete(T item)
    Emits the item event downstream with the given (potentially null) item.
    void
    fail(Throwable failure)
    Emits the failure event downstream with the given exception.
    onTermination(Runnable onTermination)
    Attaches a @{code termination} event handler invoked when the downstream UniSubscription is cancelled, or when the emitter has emitted either an item or failure event.

    Methods inherited from interface io.smallrye.mutiny.subscription.ContextSupport

    context
  • Method Details

    • complete

      void complete(T item)
      Emits the item event downstream with the given (potentially null) item.

      Calling this method multiple times or after the fail(Throwable) method has no effect.

      Parameters:
      item - the item, may be null
    • fail

      void fail(Throwable failure)
      Emits the failure 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 be null
    • onTermination

      UniEmitter<T> onTermination(Runnable onTermination)
      Attaches a @{code termination} event handler invoked when the downstream UniSubscription is cancelled, or when the emitter has emitted either an item or failure 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 be null
      Returns:
      this emitter