Class EmitterImpl<T>

  • Type Parameters:
    T - the type of payload sent by the emitter.
    All Implemented Interfaces:
    Emitter<T>

    public class EmitterImpl<T>
    extends Object
    implements Emitter<T>
    Implementation of the emitter pattern.
    • Constructor Detail

      • EmitterImpl

        public EmitterImpl​(String name,
                           String overFlowStrategy,
                           long bufferSize,
                           long defaultBufferSize)
    • Method Detail

      • getPublisher

        public org.reactivestreams.Publisher<Message<? extends T>> getPublisher()
      • send

        public CompletionStage<Void> send​(T msg)
        Description copied from interface: Emitter
        Sends a payload to the channel.
        Specified by:
        send in interface Emitter<T>
        Parameters:
        msg - the thing to send, must not be null
        Returns:
        the CompletionStage, which will be completed as sending the payload alone does not provide a callback mechanism.
      • send

        public <M extends Message<? extends T>> void send​(M msg)
        Description copied from interface: Emitter
        Sends a payload to the channel.
        Specified by:
        send in interface Emitter<T>
        Type Parameters:
        M - the Message type
        Parameters:
        msg - the Message to send, must not be null
      • complete

        public void complete()
        Description copied from interface: Emitter
        Sends the completion event to the channel indicating that no other events will be sent afterward.
        Specified by:
        complete in interface Emitter<T>
      • error

        public void error​(Exception e)
        Description copied from interface: Emitter
        Sends a failure event to the channel. No more events will be sent afterward.
        Specified by:
        error in interface Emitter<T>
        Parameters:
        e - the exception, must not be null
      • isCancelled

        public boolean isCancelled()
        Specified by:
        isCancelled in interface Emitter<T>
        Returns:
        true if the emitter has been terminated or the subscription cancelled.