Top Description Inners Constructors Methods
reactor.core.publisher

public final Class Sinks

extends Object
Class Inheritance
Imports
java.time.Duration, java.util.Queue, org.reactivestreams.Publisher, .Subscriber, reactor.core.Disposable, .Exceptions, .Scannable, reactor.core.scheduler.Scheduler, reactor.util.annotation.Nullable, reactor.util.concurrent.Queues, reactor.util.context.Context

Sinks are constructs through which Reactive Streams signals can be programmatically pushed, with Flux or Mono semantics. These standalone sinks expose tryEmit methods that return an EmitResult enum, allowing to atomically fail in case the attempted signal is inconsistent with the spec and/or the state of the sink.

This class exposes a collection of (Sinks.Many builders and Sinks.One factories. Unless constructed through the unsafe() spec, these sinks are thread safe in the sense that they will detect concurrent access and fail fast on one of the attempts. unsafe() sinks on the other hand are expected to be externally synchronized (typically by being called from within a Reactive Streams-compliant context, like a Subscriber or an operator, which means it is ok to remove the overhead of detecting concurrent access from the sink itself).

Authors
Simon Baslé, Stephane Maldini

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Sinks.EmissionException

An exception representing a failed EmitResult.

public static interface
Sinks.EmitFailureHandler

A handler supporting the emit API (eg.

public static enum
Sinks.EmitResult

Represents the immediate result of an emit attempt (eg.

public static interface
Sinks.Empty<
a generic type for the Mono view, allowing composition
T
>

A base interface for standalone Sinks with complete-or-fail semantics.

public static interface
Sinks.Many<T>

A base interface for standalone Sinks with Flux semantics.

public static interface
Sinks.ManySpec

Provides Sinks.Many specs for sinks which can emit multiple elements

public static interface
Sinks.ManyWithUpstream<
the type of data emitted by the sink
T
>

A Sinks.Many which additionally allows being subscribed to an upstream Publisher, which is an advanced pattern requiring external synchronization.

public static interface
Sinks.ManyWithUpstreamUnsafeSpec

Instead of unsafe flavors of Sinks.Many, this spec provides ManyWithUpstream implementations.

public static interface
Sinks.MulticastReplaySpec

Provides multicast with history/replay capacity : 1 sink, N Subscriber

public static interface
Sinks.MulticastSpec

Provides multicast : 1 sink, N Subscriber

public static interface
Sinks.One<T>

A base interface for standalone Sinks with Mono semantics.

pack-priv static class
public static interface
Sinks.RootSpec

Provides a choice of Sinks.One/Sinks.Empty factories and further specs for Sinks.Many.

public static interface
Sinks.UnicastSpec

Provides unicast: 1 sink, 1 Subscriber

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <T> Sinks.Empty<T>

Returns:

a new Sinks.Empty
empty
()

A Sinks.Empty which exclusively produces one terminal signal: error or complete.

public static Sinks.ManySpec

Returns:

ManySpec
many
()

Help building Sinks.Many sinks that will broadcast multiple signals to one or more Subscriber.

public static <T> Sinks.One<T>

Returns:

a new Sinks.One
one
()

A Sinks.One that works like a conceptual promise: it can be completed with or without a value at any time, but only once.

public static Sinks.RootSpec

Returns:

RootSpec
unsafe
()

Return a root spec for more advanced use cases such as building operators.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait