Package reactor.core.publisher
Enum Sinks.EmitResult
- All Implemented Interfaces:
Serializable,Comparable<Sinks.EmitResult>,Constable
- Enclosing class:
- Sinks
Represents the immediate result of an emit attempt (eg. in
Sinks.Many.tryEmitNext(Object).
This does not guarantee that a signal is consumed, it simply refers to the sink state when an emit method is invoked.
This is a particularly important distinction with regard to FAIL_CANCELLED which means the sink is -now-
interrupted and emission can't proceed. Consequently, it is possible to emit a signal and obtain an "OK" status even
if an in-flight cancellation is happening. This is due to the async nature of these actions: producer emits while
consumer can interrupt independently.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionHas failed to emit the signal because the sink was previously interrupted by its consumerHas failed to emit the signal because the access was not serializedHas failed to emit the signal because the sink does not have buffering capacity leftHas failed to emit the signal because the sink was previously terminated successfully or with an errorHas failed to emit the signal because the sink has never been subscribed to has no capacity to buffer the signal.Has successfully emitted the signal -
Method Summary
Modifier and TypeMethodDescriptionbooleanRepresents a failure to emit a signal.booleanRepresents a successful emission of a signal.voidorThrow()Easily convert from anSinks.EmitResultto throwing an exception onfailure cases.voidorThrowWithCause(Throwable cause) Easily convert from anSinks.EmitResultto throwing an exception onfailure cases.static Sinks.EmitResultReturns the enum constant of this type with the specified name.static Sinks.EmitResult[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
OK
Has successfully emitted the signal -
FAIL_TERMINATED
Has failed to emit the signal because the sink was previously terminated successfully or with an error -
FAIL_OVERFLOW
Has failed to emit the signal because the sink does not have buffering capacity left -
FAIL_CANCELLED
Has failed to emit the signal because the sink was previously interrupted by its consumer -
FAIL_NON_SERIALIZED
Has failed to emit the signal because the access was not serialized -
FAIL_ZERO_SUBSCRIBER
Has failed to emit the signal because the sink has never been subscribed to has no capacity to buffer the signal.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
isSuccess
public boolean isSuccess()Represents a successful emission of a signal.This is more future-proof than checking for equality with
OKsince new OK-like codes could be introduced later. -
isFailure
public boolean isFailure()Represents a failure to emit a signal. -
orThrow
public void orThrow()Easily convert from anSinks.EmitResultto throwing an exception onfailure cases. This is useful if throwing is the most relevant way of dealing with a failed emission attempt. Note however that generally Reactor code doesn't favor throwing exceptions but rather propagating them through onError signals. See alsoorThrowWithCause(Throwable)in case of anemitErrorfailure for which you want to attach the originally pushedException.- See Also:
-
orThrowWithCause
Easily convert from anSinks.EmitResultto throwing an exception onfailure cases. This is useful if throwing is the most relevant way of dealing with failedtryEmitErrorattempt, in which case you probably wants to propagate the originally pushedException. Note however that generally Reactor code doesn't favor throwing exceptions but rather propagating them through onError signals.- See Also:
-