Interface Subscriber<V>

  • Type Parameters:
    V - the value that will be received
    All Known Subinterfaces:
    Processor<I,​O>, Processor.Iso<V>, Processor.Transactional<I,​O>, Processor.TransactionalIso<V>, TransactionalSubscriber<V>
    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 Subscriber<V>
    A listener to events that may be called by an Publisher.

    For every publisher this subscriber is subscribed to, the subscriber will only process one event at a time -- effectively, within a single publisher this subscriber does not have to be aware of concurrent effects.

    Since:
    4.0.0
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void onClose()
      When the Publisher this is subscribed to closes without error, this method will be called.
      default void onError​(java.lang.Throwable thrown)
      When an error occurs while subscribing to an Publisher, or is thrown during the execution of submit(Object) that is not otherwise handled, this method will be called with the error.
      void submit​(V item)
      Called to submit a new item.
    • Method Detail

      • submit

        void submit​(V item)
        Called to submit a new item.
        Parameters:
        item - the item available
        Since:
        4.0.0
      • onError

        default void onError​(java.lang.Throwable thrown)
        When an error occurs while subscribing to an Publisher, or is thrown during the execution of submit(Object) that is not otherwise handled, this method will be called with the error. The associated Publisher will not send further update signals after an error is thrown.
        Parameters:
        thrown - the exception thrown
        Since:
        4.0.0
      • onClose

        default void onClose()
        When the Publisher this is subscribed to closes without error, this method will be called.
        Since:
        4.0.0