Interface UniEmitter<T>

  • Type Parameters:
    T - the expected type of item.
    All Superinterfaces:
    ContextSupport
    All Known Implementing Classes:
    DefaultUniEmitter

    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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void complete​(T item)
      Emits the item event downstream with the given (potentially null) item.
      void fail​(java.lang.Throwable failure)
      Emits the failure event downstream with the given exception.
      UniEmitter<T> onTermination​(java.lang.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.
    • Method Detail

      • 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​(java.lang.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​(java.lang.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