Interface Sinks.ManyWithUpstream<T>

Type Parameters:
T - the type of data emitted by the sink
All Superinterfaces:
Scannable, Sinks.Many<T>
All Known Implementing Classes:
EmitterProcessor
Enclosing class:
Sinks

public static interface Sinks.ManyWithUpstream<T> extends Sinks.Many<T>
A Sinks.Many which additionally allows being subscribed to an upstream Publisher, which is an advanced pattern requiring external synchronization. See subscribeTo(Publisher)} for more details.
  • Method Details

    • subscribeTo

      Disposable subscribeTo(Publisher<? extends T> upstream)
      Explicitly subscribe this Sinks.Many to an upstream Publisher without exposing it as a Subscriber at all.

      Note that when this is done, one MUST stop using emit/tryEmit APIs, reserving signal creation to be the sole responsibility of the upstream Publisher.

      The returned Disposable provides a way of both unsubscribing from the upstream and terminating the sink: currently registered subscribers downstream receive an onError signal with a CancellationException and further attempts at subscribing to the sink will trigger a similar signal immediately (in which case the returned Disposable might be no-op).

      Any attempt at subscribing the same Sinks.ManyWithUpstream multiple times throws an IllegalStateException indicating that the subscription must be unique.