Class MonoProcessor<O>

java.lang.Object
reactor.core.publisher.Mono<O>
reactor.core.publisher.MonoProcessor<O>
Type Parameters:
O - the type of the value that will be made available
All Implemented Interfaces:
Processor<O,O>, Publisher<O>, Subscriber<O>, Subscription, CorePublisher<O>, CoreSubscriber<O>, Disposable, Scannable

@Deprecated public abstract class MonoProcessor<O> extends Mono<O> implements Processor<O,O>, CoreSubscriber<O>, Disposable, Subscription, Scannable
Deprecated.
Processors will be removed in 3.5. Prefer using Sinks.One or Sinks.Empty instead, or see https://github.com/reactor/reactor-core/issues/2431 for alternatives
A MonoProcessor is a Processor that is also a Mono.

Implementations might implements stateful semantics, allowing multiple subscriptions. Once a MonoProcessor has been resolved, implementations may also replay cached signals to newer subscribers.

Despite having default implementations, most methods should be reimplemented with meaningful semantics relevant to concrete child classes.

Author:
Stephane Maldini
  • Constructor Details

    • MonoProcessor

      public MonoProcessor()
      Deprecated.
  • Method Details

    • create

      @Deprecated public static <T> MonoProcessor<T> create()
      Deprecated.
      Use Sinks.one(), to be removed in 3.5
      Create a MonoProcessor that will eagerly request 1 on Subscriber.onSubscribe(Subscription), cache and emit the eventual result for 1 or N subscribers.
      Type Parameters:
      T - type of the expected value
      Returns:
      A MonoProcessor.
    • cancel

      @Deprecated public void cancel()
      Deprecated.
      the MonoProcessor will cease to implement Subscription in 3.5
      Specified by:
      cancel in interface Subscription
    • isCancelled

      @Deprecated public boolean isCancelled()
      Deprecated.
      the MonoProcessor will cease to implement Subscription and this method will be removed in 3.5
      Indicates whether this MonoProcessor has been interrupted via cancellation.
      Returns:
      true if this MonoProcessor is cancelled, false otherwise.
    • request

      @Deprecated public void request(long n)
      Deprecated.
      the MonoProcessor will cease to implement Subscription in 3.5
      Specified by:
      request in interface Subscription
      Parameters:
      n - the request amount
    • dispose

      public void dispose()
      Deprecated.
      Description copied from interface: Disposable
      Cancel or dispose the underlying task or resource.

      Implementations are required to make this method idempotent.

      Specified by:
      dispose in interface Disposable
    • block

      public @Nullable O block()
      Deprecated.
      Block the calling thread indefinitely, waiting for the completion of this MonoProcessor. If the MonoProcessor is completed with an error a RuntimeException that wraps the error is thrown.
      Overrides:
      block in class Mono<O>
      Returns:
      the value of this MonoProcessor
    • block

      public @Nullable O block(@Nullable Duration timeout)
      Deprecated.
      Block the calling thread for the specified time, waiting for the completion of this MonoProcessor. If the MonoProcessor is completed with an error a RuntimeException that wraps the error is thrown.
      Overrides:
      block in class Mono<O>
      Parameters:
      timeout - the timeout value as a Duration
      Returns:
      the value of this MonoProcessor or null if the timeout is reached and the MonoProcessor has not completed
    • getError

      public @Nullable Throwable getError()
      Deprecated.
      Return the produced Throwable error if any or null
      Returns:
      the produced Throwable error if any or null
    • isError

      public final boolean isError()
      Deprecated.
      Indicates whether this MonoProcessor has been completed with an error.
      Returns:
      true if this MonoProcessor was completed with an error, false otherwise.
    • isSuccess

      public final boolean isSuccess()
      Deprecated.
      Indicates whether this MonoProcessor has been successfully completed a value.
      Returns:
      true if this MonoProcessor is successful, false otherwise.
    • isTerminated

      public boolean isTerminated()
      Deprecated.
      Indicates whether this MonoProcessor has been terminated by the source producer with a success or an error.
      Returns:
      true if this MonoProcessor is successful, false otherwise.
    • isDisposed

      public boolean isDisposed()
      Deprecated.
      Description copied from interface: Disposable
      Optionally return true when the resource or task is disposed.

      Implementations are not required to track disposition and as such may never return true even when disposed. However, they MUST only return true when there's a guarantee the resource or task is disposed.

      Specified by:
      isDisposed in interface Disposable
      Returns:
      true when there's a guarantee the resource or task is disposed.
    • peek

      @Deprecated public @Nullable O peek()
      Deprecated.
      this method is discouraged, consider peeking into a MonoProcessor by turning it into a CompletableFuture
      Returns the value that completed this MonoProcessor. Returns null if the MonoProcessor has not been completed. If the MonoProcessor is completed with an error a RuntimeException that wraps the error is thrown.
      Returns:
      the value that completed the MonoProcessor, or null if it has not been completed
      Throws:
      RuntimeException - if the MonoProcessor was completed with an error
    • currentContext

      public Context currentContext()
      Deprecated.
      Description copied from interface: CoreSubscriber
      Request a Context from dependent components which can include downstream operators during subscribing or a terminal Subscriber.
      Specified by:
      currentContext in interface CoreSubscriber<O>
      Returns:
      a resolved context or Context.empty()
    • scanUnsafe

      public @Nullable Object scanUnsafe(Scannable.Attr key)
      Deprecated.
      Description copied from interface: Scannable
      This method is used internally by components to define their key-value mappings in a single place. Although it is ignoring the generic type of the Scannable.Attr key, implementors should take care to return values of the correct type, and return null if no specific value is available.

      For public consumption of attributes, prefer using Scannable.scan(Attr), which will return a typed value and fall back to the key's default if the component didn't define any mapping.

      Specified by:
      scanUnsafe in interface Scannable
      Parameters:
      key - a Scannable.Attr to resolve for the component.
      Returns:
      the value associated to the key for that specific component, or null if none.
    • downstreamCount

      public long downstreamCount()
      Deprecated.
      Return the number of active Subscriber or -1 if untracked.
      Returns:
      the number of active Subscriber or -1 if untracked
    • hasDownstreams

      public final boolean hasDownstreams()
      Deprecated.
      Return true if any Subscriber is actively subscribed
      Returns:
      true if any Subscriber is actively subscribed
    • inners

      public Stream<? extends Scannable> inners()
      Deprecated.
      Description copied from interface: Scannable
      Return a Stream of referenced inners (flatmap, multicast etc)
      Specified by:
      inners in interface Scannable
      Returns:
      a Stream of referenced inners (flatmap, multicast etc)