Class ConnectableConsumer<T>

  • Type Parameters:
    T - the type of the input
    All Implemented Interfaces:
    Consumer<T>

    @ParametersAreNonnullByDefault
    public class ConnectableConsumer<T>
    extends Object
    implements Consumer<T>
    A proxy Consumer that collects the items it accepts, then pass them through to a target Consumer when connected. In this way, you can start accepting items before the target Consumer is available.
    Since:
    7.11
    • Constructor Detail

      • ConnectableConsumer

        public ConnectableConsumer()
    • Method Detail

      • connect

        public void connect​(Consumer<T> consumer)
        Process all buffered items, and send all future items to the target Consumer
        Parameters:
        consumer -
      • accept

        public void accept​(T t)
        Specified by:
        accept in interface Consumer<T>