Interface AsyncStreamHandler<T>

  • Type Parameters:
    T - The type of the stream element.
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface AsyncStreamHandler<T>
    A type to asynchronously deliver the signals (element, error, completion) from a AsyncStream.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void onComplete()
      A terminal signal indicating that the stream terminated successfully.
      default void onError​(java.lang.Throwable throwable)
      A terminal signal indicating that the stream terminated due to an error.
      default void onInit​(CancellationToken cancellationToken)
      Invoked before initiating element retrieval from the stream.
      void onNext​(T e)
      The next element produced by the stream.
    • Method Detail

      • onInit

        default void onInit​(CancellationToken cancellationToken)
        Invoked before initiating element retrieval from the stream.
        Parameters:
        cancellationToken - The token to cancel the steam from producing and delivering elements to onNext(e).
      • onNext

        void onNext​(T e)
        The next element produced by the stream.
        Parameters:
        e - the element signaled.
      • onError

        default void onError​(java.lang.Throwable throwable)
        A terminal signal indicating that the stream terminated due to an error.
        Parameters:
        throwable - the error signaled.
      • onComplete

        default void onComplete()
        A terminal signal indicating that the stream terminated successfully.