Trait/Object

reactor.core.scala.publisher

SMono

Related Docs: object SMono | package publisher

Permalink

trait SMono[+T] extends SMonoLike[T] with MapablePublisher[T] with ScalaConverters

A Reactive Streams Publisher with basic rx operators that completes successfully by emitting an element, or with an error.

The rx operators will offer aliases for input SMono type to preserve the "at most one" property of the resulting SMono. For instance flatMap returns a SFlux with possibly more than 1 emission. Its alternative enforcing SMono input is then.

SMono[Unit] should be used for Publisher that just completes without any value.

It is intended to be used in implementations and return types, input parameters should keep using raw Publisher as much as possible.

Note that using state in the scala.Function / lambdas used within Mono operators should be avoided, as these may be shared between several Subscribers.

T

the type of the single value of this class

See also

SFlux

Linear Supertypes
MapablePublisher[T], Publisher[T @scala.annotation.unchecked.uncheckedVariance], SMonoLike[T], ScalaConverters, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SMono
  2. MapablePublisher
  3. Publisher
  4. SMonoLike
  5. ScalaConverters
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. implicit class PimpConnectableFlux[T] extends AnyRef

    Permalink
    Definition Classes
    ScalaConverters
  2. implicit class PimpJFlux[T] extends AnyRef

    Permalink
    Definition Classes
    ScalaConverters
  3. implicit class PimpJMono[T] extends AnyRef

    Permalink
    Definition Classes
    ScalaConverters

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def *[R >: T](other: SMono[R])(implicit R: Numeric[R]): SMono[R]

    Permalink

    Multiply element of this SMono with element of the other one.

    Multiply element of this SMono with element of the other one.

    R

    Numeric

    other

    The other element

    returns

    SMono containing the product of this and the other one.

    Definition Classes
    SMonoLike
  4. final def +[R >: T](other: SMono[R])(implicit R: Numeric[R]): SMono[R]

    Permalink

    Adding element of this SMono with the element of the other one.

    Adding element of this SMono with the element of the other one.

    R

    Numeric

    other

    The other element

    returns

    SMono containing the sum of this and the other one.

    Definition Classes
    SMonoLike
  5. final def ++[U >: T](other: Publisher[U]): SFlux[U]

    Permalink

    Alias for SMono.concatWith

    Alias for SMono.concatWith

    other

    the Publisher sequence to concat after this SMono

    returns

    a concatenated SFlux

    Definition Classes
    SMonoLike
  6. final def -[R >: T](other: SMono[R])(implicit R: Numeric[R]): SMono[R]

    Permalink

    Subtract element in this SMono with the element of the other one

    Subtract element in this SMono with the element of the other one

    R

    Numeric

    other

    The other eleent

    returns

    SMono containing the result of subtraction.

    Definition Classes
    SMonoLike
  7. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  8. final def and(other: Publisher[_]): SMono[Unit]

    Permalink

    Join the termination signals from this mono and another source into the returned void mono

    Join the termination signals from this mono and another source into the returned void mono

    other

    the Publisher to wait for complete

    returns

    a new combined SMono

    See also

    SMono.when

  9. final def as[P](transformer: (SMono[T]) ⇒ P): P

    Permalink

    Transform this SMono into a target type.

    Transform this SMono into a target type.

    mono.as(Flux::from).subscribe()

    P

    the returned instance type

    transformer

    the { @link Function} applying this { @link Mono}

    returns

    the transformed SMono to instance P

    See also

    SMono.compose for a bounded conversion to org.reactivestreams.Publisher

  10. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  11. final def asJava(): Mono[T]

    Permalink

    Get the underlying reactor.core.publisher.Mono

    Get the underlying reactor.core.publisher.Mono

    returns

    reactor.core.publisher.Mono

  12. final def block(timeout: Duration = Duration.Inf): T

    Permalink

    Block until a next signal is received, will return null if onComplete, T if onNext, throw a Exceptions.DownstreamException if checked error or origin RuntimeException if unchecked.

    Block until a next signal is received, will return null if onComplete, T if onNext, throw a Exceptions.DownstreamException if checked error or origin RuntimeException if unchecked. If the default timeout 30 seconds has elapsed,a RuntimeException will be thrown.

    Note that each block() will subscribe a new single (MonoSink) subscriber, in other words, the result might miss signal from hot publishers.

    timeout

    maximum time period to wait for before raising a RuntimeException. Defaulted to Duration.Inf

    returns

    T the result

  13. final def blockOption(timeout: Duration = Duration.Inf): Option[T]

    Permalink

    Subscribe to this SMono and block until a next signal is received, the Mono completes empty or a timeout expires.

    Subscribe to this SMono and block until a next signal is received, the Mono completes empty or a timeout expires. Returns an Option for the first two cases, which can be used to replace the empty case with an Exception via exception). In case the Mono itself errors, the original exception is thrown (wrapped in a RuntimeException if it was a checked exception). If the provided timeout expires, a RuntimeException is thrown.

    Note that each block() will trigger a new subscription: in other words, the result might miss signal from hot publishers.

    timeout

    maximum time period to wait for before raising a RuntimeException. Defaulted to Duration.Inf

    returns

    T the result

  14. final def cache(ttl: Duration = Duration.Inf): SMono[T]

    Permalink

    Turn this SMono into a hot source and cache last emitted signals for further Subscriber, with an expiry timeout.

    Turn this SMono into a hot source and cache last emitted signals for further Subscriber, with an expiry timeout.

    Completion and Error will also be replayed until ttl triggers in which case the next Subscriber will start over a new subscription.

    returns

    a replaying SMono

  15. final def cancelOn(scheduler: Scheduler): SMono[T]

    Permalink

    Prepare this SMono so that subscribers will cancel from it on a specified reactor.core.scheduler.Scheduler.

    Prepare this SMono so that subscribers will cancel from it on a specified reactor.core.scheduler.Scheduler.

    scheduler

    the reactor.core.scheduler.Scheduler to signal cancel on

    returns

    a scheduled cancel SMono

  16. final def cast[E](implicit classTag: ClassTag[E]): SMono[E]

    Permalink

    Cast the current SMono produced type into a target produced type.

    Cast the current SMono produced type into a target produced type.

    E

    the SMono output type

    returns

    a casted SMono

  17. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def concatWith[U >: T](other: Publisher[U]): SFlux[U]

    Permalink

    Concatenate emissions of this SMono with the provided Publisher (no interleave).

    Concatenate emissions of this SMono with the provided Publisher (no interleave).

    other

    the Publisher sequence to concat after this SFlux

    returns

    a concatenated SFlux

    Definition Classes
    SMonoLike
  19. final def defaultIfEmpty[U >: T](defaultV: U): SMono[U]

    Permalink

    Provide a default unique value if this mono is completed without any data

    Provide a default unique value if this mono is completed without any data

    defaultV

    the alternate value if this sequence is empty

    returns

    a new SMono

    See also

    SFlux.defaultIfEmpty

  20. final def delayElement(delay: Duration, timer: Scheduler = Schedulers.parallel()): SMono[T]

    Permalink

    Delay this SMono element (Subscriber.onNext signal) by a given Duration, on a particular Scheduler.

    Delay this SMono element (Subscriber.onNext signal) by a given Duration, on a particular Scheduler. Empty monos or error signals are not delayed.

    Note that the scheduler on which the mono chain continues execution will be the scheduler provided if the mono is valued, or the current scheduler if the mono completes empty or errors.

    delay

    Duration by which to delay the Subscriber.onNext signal

    timer

    a time-capable Scheduler instance to delay the value signal on

    returns

    a delayed SMono

  21. final def delaySubscription[U](subscriptionDelay: Publisher[U]): SMono[T]

    Permalink

    Delay the subscription to this SMono until another Publisher signals a value or completes.

    Delay the subscription to this SMono until another Publisher signals a value or completes.

    U

    the other source type

    subscriptionDelay

    a Publisher to signal by next or complete this SMono.subscribe

    returns

    a delayed SMono

  22. final def delaySubscription(delay: Duration, timer: Scheduler = Schedulers.parallel()): SMono[T]

    Permalink

    Delay the subscription to this SMono source until the given Duration elapses.

    Delay the subscription to this SMono source until the given Duration elapses.

    delay

    Duration before subscribing this SMono

    timer

    a time-capable Scheduler instance to run on

    returns

    a delayed SMono

  23. final def delayUntil(triggerProvider: (T) ⇒ Publisher[_]): SMono[T]

    Permalink

    Subscribe to this SMono and another Publisher that is generated from this Mono's element and which will be used as a trigger for relaying said element.

    Subscribe to this SMono and another Publisher that is generated from this Mono's element and which will be used as a trigger for relaying said element.

    That is to say, the resulting SMono delays until this Mono's element is emitted, generates a trigger Publisher and then delays again until the trigger Publisher terminates.

    Note that contiguous calls to all delayUntil are fused together. The triggers are generated and subscribed to in sequence, once the previous trigger completes. Error is propagated immediately downstream. In both cases, an error in the source is immediately propagated.

    triggerProvider

    a Function1 that maps this Mono's value into a Publisher whose termination will trigger relaying the value.

    returns

    this SMono, but delayed until the derived publisher terminates.

  24. final def dematerialize[X](): SMono[X]

    Permalink

    A "phantom-operator" working only if this SMono is a emits onNext, onError or onComplete reactor.core.publisher.Signal.

    A "phantom-operator" working only if this SMono is a emits onNext, onError or onComplete reactor.core.publisher.Signal. The relative org.reactivestreams.Subscriber callback will be invoked, error reactor.core.publisher.Signal will trigger onError and complete reactor.core.publisher.Signal will trigger onComplete.

    X

    the dematerialized type

    returns

    a dematerialized SMono

  25. final def doAfterTerminate(afterTerminate: () ⇒ Unit): SMono[T]

    Permalink

    Add behavior (side-effect) triggered after the SMono terminates, either by completing downstream successfully or with an error.

    Add behavior (side-effect) triggered after the SMono terminates, either by completing downstream successfully or with an error.

    afterTerminate

    the callback to call after Subscriber.onComplete or Subscriber.onError

    returns

    an observed SMono

  26. final def doFinally(onFinally: (SignalType) ⇒ Unit): SMono[T]

    Permalink

    Add behavior triggering after the SMono terminates for any reason, including cancellation.

    Add behavior triggering after the SMono terminates for any reason, including cancellation. The terminating event SignalType.ON_COMPLETE, SignalType#ON_ERROR and SignalType#CANCEL) is passed to the consumer, which is executed after the signal has been passed downstream.

    Note that the fact that the signal is propagated downstream before the callback is executed means that several doFinally in a row will be executed in reverse order. If you want to assert the execution of the callback please keep in mind that the Mono will complete before it is executed, so its effect might not be visible immediately after eg. a SMono.block().

    onFinally

    the callback to execute after a terminal signal (complete, error or cancel)

    returns

    an observed SMono

  27. final def doOnCancel(onCancel: () ⇒ Unit): SMono[T]

    Permalink

    Triggered when the SMono is cancelled.

    Triggered when the SMono is cancelled.

    onCancel

    the callback to call on org.reactivestreams.Subscriber.cancel

    returns

    a new SMono

  28. final def doOnError(onError: (Throwable) ⇒ Unit): SMono[T]

    Permalink

    Triggered when the SMono completes with an error.

    Triggered when the SMono completes with an error.

    onError

    the error callback to call on org.reactivestreams.Subscriber.onError

    returns

    a new SMono

  29. final def doOnNext(onNext: (T) ⇒ Unit): SMono[T]

    Permalink

    Add behavior triggered when the SMono emits a data successfully.

    Add behavior triggered when the SMono emits a data successfully.

    onNext

    the callback to call on Subscriber.onNext

    returns

    a new SMono

  30. final def doOnRequest(consumer: (Long) ⇒ Unit): SMono[T]

    Permalink

    Attach a Long consumer to this SMono that will observe any request to this SMono.

    Attach a Long consumer to this SMono that will observe any request to this SMono.

    consumer

    the consumer to invoke on each request

    returns

    an observed SMono

  31. final def doOnSubscribe(onSubscribe: (Subscription) ⇒ Unit): SMono[T]

    Permalink

    Triggered when the SMono is subscribed.

    Triggered when the SMono is subscribed.

    onSubscribe

    the callback to call on Subscriber.onSubscribe

    returns

    a new SMono

  32. final def doOnSuccess(onSuccess: (T) ⇒ Unit): SMono[T]

    Permalink

    Triggered when the SMono completes successfully.

    Triggered when the SMono completes successfully.

    • null : completed without data
    • T: completed with data

    onSuccess

    the callback to call on, argument is null if the SMono completes without data org.reactivestreams.Subscriber.onNext or org.reactivestreams.Subscriber.onComplete without preceding org.reactivestreams.Subscriber.onNext

    returns

    a new SMono

  33. final def doOnTerminate(onTerminate: () ⇒ Unit): SMono[T]

    Permalink

    Add behavior triggered when the SMono terminates, either by completing successfully or with an error.

    Add behavior triggered when the SMono terminates, either by completing successfully or with an error.

    onTerminate

    the callback to call Subscriber.onNext, Subscriber.onComplete without preceding Subscriber.onNext or Subscriber.onError

    returns

    a new SMono

  34. final def elapsed(scheduler: Scheduler = Schedulers.parallel()): SMono[(Long, T)]

    Permalink

    Map this SMono sequence into scala.Tuple2 of T1 Long timemillis and T2 T associated data.

    Map this SMono sequence into scala.Tuple2 of T1 Long timemillis and T2 T associated data. The timemillis corresponds to the elapsed time between the subscribe and the first next signal.

    scheduler

    the Scheduler to read time from. Defaulted to Schedulers.parallel()

    returns

    a transforming SMono that emits a tuple of time elapsed in milliseconds and matching data

  35. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  36. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  37. final def expand[U >: T](expander: (T) ⇒ Publisher[U], capacityHint: Int = SMALL_BUFFER_SIZE): SFlux[U]

    Permalink

    Recursively expand elements into a graph and emit all the resulting element using a breadth-first traversal strategy.

    Recursively expand elements into a graph and emit all the resulting element using a breadth-first traversal strategy.

    That is: emit the value from this SMono first, then it each at a first level of recursion and emit all of the resulting values, then expand all of these at a second level and so on...

    For example, given the hierarchical structure

    A
      - AA
        - aa1
      - AB
        - ab1
      - a1
    

    Expands Mono.just(A) into

    A
    AA
    AB
    a1
    aa1
    ab1
    

    expander

    the Function1 applied at each level of recursion to expand values into a Publisher, producing a graph.

    capacityHint

    a capacity hint to prepare the inner queues to accommodate n elements per level of recursion.

    returns

    this Mono expanded breadth-first to a SFlux

  38. final def expandDeep[U >: T](expander: (T) ⇒ Publisher[U], capacityHint: Int = SMALL_BUFFER_SIZE): SFlux[U]

    Permalink

    Recursively expand elements into a graph and emit all the resulting element, in a depth-first traversal order.

    Recursively expand elements into a graph and emit all the resulting element, in a depth-first traversal order.

    That is: emit the value from this SMono, expand it and emit the first value at this first level of recursion, and so on... When no more recursion is possible, backtrack to the previous level and re-apply the strategy.

    For example, given the hierarchical structure

    A
      - AA
        - aa1
      - AB
        - ab1
      - a1
    

    Expands Mono.just(A) into

    A
    AA
    aa1
    AB
    ab1
    a1
    

    expander

    the Function1 applied at each level of recursion to expand values into a Publisher, producing a graph.

    capacityHint

    a capacity hint to prepare the inner queues to accommodate n elements per level of recursion.

    returns

    this Mono expanded depth-first to a SFlux

  39. final def filter(tester: (T) ⇒ Boolean): SMono[T]

    Permalink

    Test the result if any of this SMono and replay it if predicate returns true.

    Test the result if any of this SMono and replay it if predicate returns true. Otherwise complete without value.

    tester

    the predicate to evaluate

    returns

    a filtered SMono

  40. final def filterWhen(asyncPredicate: Function1[T, _ <: MapablePublisher[Boolean]]): SMono[T]

    Permalink

    If this SMono is valued, test the value asynchronously using a generated Publisher[Boolean] test.

    If this SMono is valued, test the value asynchronously using a generated Publisher[Boolean] test. The value from the Mono is replayed if the first item emitted by the test is true. It is dropped if the test is either empty or its first emitted value is false.

    Note that only the first value of the test publisher is considered, and unless it is a SMono, test will be cancelled after receiving that first value.

    asyncPredicate

    the function generating a Publisher of Boolean to filter the Mono with

    returns

    a filtered SMono

  41. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  42. final def flatMap[R](transformer: (T) ⇒ SMono[R]): SMono[R]

    Permalink

    Transform the item emitted by this SMono asynchronously, returning the value emitted by another SMono (possibly changing the value type).

    Transform the item emitted by this SMono asynchronously, returning the value emitted by another SMono (possibly changing the value type).

    R

    the result type bound

    transformer

    the function to dynamically bind a new SMono

    returns

    a new SMono with an asynchronously mapped value.

  43. final def flatMapIterable[R](mapper: (T) ⇒ Iterable[R]): SFlux[R]

    Permalink

    Transform the item emitted by this SMono into Iterable, , then forward its elements into the returned SFlux.

    Transform the item emitted by this SMono into Iterable, , then forward its elements into the returned SFlux. The prefetch argument allows to give an arbitrary prefetch size to the inner Iterable.

    R

    the merged output sequence type

    mapper

    the Function1 to transform input item into a sequence Iterable

    returns

    a merged SFlux

  44. final def flatMapMany[R](mapperOnNext: (T) ⇒ Publisher[R], mapperOnError: (Throwable) ⇒ Publisher[R], mapperOnComplete: () ⇒ Publisher[R]): SFlux[R]

    Permalink

    Transform the signals emitted by this SMono into a Publisher, then forward its emissions into the returned SFlux.

    Transform the signals emitted by this SMono into a Publisher, then forward its emissions into the returned SFlux.

    R

    the type of the produced inner sequence

    mapperOnNext

    the Function1 to call on next data and returning a sequence to merge

    mapperOnError

    theFunction1 to call on error signal and returning a sequence to merge

    mapperOnComplete

    the Function1 to call on complete signal and returning a sequence to merge

    returns

    a new SFlux as the sequence is not guaranteed to be single at most

    See also

    SFlux.flatMap

  45. final def flatMapMany[R](mapper: (T) ⇒ Publisher[R]): SFlux[R]

    Permalink

    Transform the item emitted by this SMono into a Publisher, then forward its emissions into the returned SFlux.

    Transform the item emitted by this SMono into a Publisher, then forward its emissions into the returned SFlux.

    R

    the merged sequence type

    mapper

    the Function1 to produce a sequence of R from the the eventual passed Subscriber.onNext

    returns

    a new SFlux as the sequence is not guaranteed to be single at most

  46. final def flux(): SFlux[T]

    Permalink

    Convert this SMono to a SFlux

    Convert this SMono to a SFlux

    returns

    a SFlux variant of this SMono

  47. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  48. final def handle[R](handler: (T, SynchronousSink[R]) ⇒ Unit): SMono[R]

    Permalink

    Handle the items emitted by this SMono by calling a biconsumer with the output sink for each onNext.

    Handle the items emitted by this SMono by calling a biconsumer with the output sink for each onNext. At most one SynchronousSink.next call must be performed and/or 0 or 1 SynchronousSink.error or SynchronousSink.complete.

    R

    the transformed type

    handler

    the handling BiConsumer

    returns

    a transformed SMono

  49. final def hasElement: SMono[Boolean]

    Permalink

    Emit a single boolean true if this SMono has an element.

    Emit a single boolean true if this SMono has an element.

    returns

    a new SMono with true if a value is emitted and false otherwise

  50. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  51. final def hide(): SMono[T]

    Permalink

    Hides the identity of this SMono instance.

    Hides the identity of this SMono instance.

    The main purpose of this operator is to prevent certain identity-based optimizations from happening, mostly for diagnostic purposes.

    returns

    a new SMono instance

  52. final def ignoreElement: SMono[T]

    Permalink

    Ignores onNext signal (dropping it) and only reacts on termination.

    Ignores onNext signal (dropping it) and only reacts on termination.

    returns

    a new completable SMono.

  53. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  54. final def log(category: Option[String] = None, level: Level = Level.INFO, showOperator: Boolean = false, options: Seq[SignalType] = Nil): SMono[T]

    Permalink

    Observe Reactive Streams signals matching the passed flags options and use reactor.util.Logger support to handle trace implementation.

    Observe Reactive Streams signals matching the passed flags options and use reactor.util.Logger support to handle trace implementation. Default will use the passed Level and java.util.logging. If SLF4J is available, it will be used instead.

    Options allow fine grained filtering of the traced signal, for instance to only capture onNext and onError:

        mono.log("category", SignalType.ON_NEXT, SignalType.ON_ERROR)
    
    
    
    
    
    
    
    
    @param category to be mapped into logger configuration (e.g. org.springframework
                    .reactor). If category ends with "." like "reactor.", a generated operator
                    suffix will complete, e.g. "reactor.Flux.Map".
    @param level    the { @link Level} to enforce for this tracing Mono (only FINEST, FINE,
                                INFO, WARNING and SEVERE are taken into account)
    @param options a [[Seq]] of [[SignalType]] option to filter log messages
    @return a new [[SMono]]
    
    

  55. final def map[R](mapper: (T) ⇒ R): SMono[R]

    Permalink

    Transform the item emitted by this SMono by applying a synchronous function to it.

    Transform the item emitted by this SMono by applying a synchronous function to it.

    R

    the transformed type

    mapper

    the synchronous transforming Function1

    returns

    a new SMono

    Definition Classes
    SMonoMapablePublisher
  56. final def materialize(): SMono[Signal[_ <: T]]

    Permalink

    Transform incoming onNext, onError and onComplete signals into Signal instances, materializing these signals.

    Transform incoming onNext, onError and onComplete signals into Signal instances, materializing these signals. Since the error is materialized as a Signal, the propagation will be stopped and onComplete will be emitted. Complete signal will first emit a Signal.complete() and then effectively complete the flux. All these Signal have a reactor.util.context.Context associated to them.

    returns

    a SMono of materialized Signal

    See also

    SMono.dematerialize()

  57. final def mergeWith[U >: T](other: Publisher[U]): SFlux[U]

    Permalink

    Merge emissions of this SMono with the provided Publisher.

    Merge emissions of this SMono with the provided Publisher.

    other

    the other Publisher to merge with

    returns

    a new SFlux as the sequence is not guaranteed to be at most 1

  58. final def metrics: SMono[T]

    Permalink

    Activate metrics for this sequence, provided there is an instrumentation facade on the classpath (otherwise this method is a pure no-op).

    Activate metrics for this sequence, provided there is an instrumentation facade on the classpath (otherwise this method is a pure no-op).

    Metrics are gathered on Subscriber events, and it is recommended to also name (and optionally tag) the sequence.

    returns

    an instrumented SMono

  59. final def name(name: String): SMono[T]

    Permalink

    Give a name to this sequence, which can be retrieved using Scannable.name as long as this is the first reachable Scannable.parents.

    Give a name to this sequence, which can be retrieved using Scannable.name as long as this is the first reachable Scannable.parents.

    name

    a name for the sequence

    returns

    the same sequence, but bearing a name

  60. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  61. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  62. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  63. final def ofType[U](implicit classTag: ClassTag[U]): SMono[U]

    Permalink

    Evaluate the accepted value against the given Class type.

    Evaluate the accepted value against the given Class type. If the predicate test succeeds, the value is passed into the new SMono. If the predicate test fails, the value is ignored.

    U

    the Class type to test values against

    returns

    a new SMono reduced to items converted to the matched type

  64. final def onErrorMap(mapper: PartialFunction[Throwable, Throwable]): SMono[T]

    Permalink

    Transform the error emitted by this SMono by applying a function.

    Transform the error emitted by this SMono by applying a function.

    <img class="marble" src="https://raw.githubusercontent.com/reactor/reactor-core/v3.1.0.RC1/src/docs/marble/maperror.png"

    mapper

    the error transforming PartialFunction

    returns

    a transformed SMono

  65. final def onErrorRecover[U >: T](pf: PartialFunction[Throwable, U]): SMono[U]

    Permalink
  66. final def onErrorResume[U >: T](fallback: (Throwable) ⇒ SMono[U]): SMono[U]

    Permalink

    Subscribe to a returned fallback publisher when any error occurs.

    Subscribe to a returned fallback publisher when any error occurs.

    fallback

    the function to map an alternative SMono

    returns

    an alternating SMono on source onError

    See also

    SFlux.onErrorResume

  67. final def onTerminateDetach(): SMono[T]

    Permalink

    Detaches the both the child Subscriber and the Subscription on termination or cancellation.

    Detaches the both the child Subscriber and the Subscription on termination or cancellation.

    This should help with odd retention scenarios when running with non-reactor Subscriber.

    returns

    a detachable SMono

  68. final def or[U >: T](other: SMono[U]): SMono[U]

    Permalink

    Emit the any of the result from this mono or from the given mono

    Emit the any of the result from this mono or from the given mono

    other

    the racing other SFlux to compete with for the result

    returns

    a new SFlux

    See also

    SMono.firstEmitter()

  69. final def publish[R](transform: (SMono[_ <: T]) ⇒ SMono[R]): SMono[R]

    Permalink

    Shares a SMono for the duration of a function that may transform it and consume it as many times as necessary without causing multiple subscriptions to the upstream.

    Shares a SMono for the duration of a function that may transform it and consume it as many times as necessary without causing multiple subscriptions to the upstream.

    R

    the output value type

    transform

    the transformation function

    returns

    a new SMono

  70. final def publishOn(scheduler: Scheduler): SMono[T]

    Permalink

    Run onNext, onComplete and onError on a supplied Scheduler

    Run onNext, onComplete and onError on a supplied Scheduler

    Typically used for fast publisher, slow consumer(s) scenarios.

    mono.publishOn(Schedulers.single()).subscribe()

    scheduler

    a checked { @link reactor.core.scheduler.Scheduler.Worker} factory

    returns

    an asynchronously producing SMono

  71. final def repeat(numRepeat: Long = Long.MaxValue, predicate: () ⇒ Boolean = () => true): SFlux[T]

    Permalink

    Repeatedly subscribe to the source completion of the previous subscription.

    Repeatedly subscribe to the source completion of the previous subscription.

    returns

    an indefinitively repeated SFlux on onComplete

  72. final def repeatWhen(whenFactory: Function1[SFlux[Long], _ <: Publisher[_]]): SFlux[T]

    Permalink

    Repeatedly subscribe to this SMono when a companion sequence signals a number of emitted elements in response to the flux completion signal.

    Repeatedly subscribe to this SMono when a companion sequence signals a number of emitted elements in response to the flux completion signal.

    If the companion sequence signals when this SMono is active, the repeat attempt is suppressed and any terminal signal will terminate this SFlux with the same signal immediately.

    whenFactory

    the Function1 providing a SFlux signalling an exclusive number of emitted elements on onComplete and returning a Publisher companion.

    returns

    an eventually repeated SFlux on onComplete when the companion Publisher produces an onNext signal

  73. final def repeatWhenEmpty(repeatFactory: (SFlux[Long]) ⇒ Publisher[_], maxRepeat: Int = Int.MaxValue): SMono[T]

    Permalink

    Repeatedly subscribe to this SMono until there is an onNext signal when a companion sequence signals a number of emitted elements.

    Repeatedly subscribe to this SMono until there is an onNext signal when a companion sequence signals a number of emitted elements.

    If the companion sequence signals when this SMono is active, the repeat attempt is suppressed and any terminal signal will terminate this SMono with the same signal immediately.

    repeatFactory

    the Function1 providing a SFlux signalling the current number of repeat on onComplete and returning a Publisher companion.

    returns

    an eventually repeated SMono on onComplete when the companion Publisher produces an onNext signal

  74. final def retry(numRetries: Long = Long.MaxValue, retryMatcher: (Throwable) ⇒ Boolean = (_: Throwable) => true): SMono[T]

    Permalink

    Re-subscribes to this SMono sequence if it signals any error either indefinitely or a fixed number of times.

    Re-subscribes to this SMono sequence if it signals any error either indefinitely or a fixed number of times.

    The times == Long.MAX_VALUE is treated as infinite retry.

    numRetries

    the number of times to tolerate an error

    returns

    a re-subscribing SMono on onError up to the specified number of retries.

  75. final def retryWhen(whenFactory: (SFlux[Throwable]) ⇒ Publisher[_]): SMono[T]

    Permalink

    Retries this SMono when a companion sequence signals an item in response to this SMono error signal

    Retries this SMono when a companion sequence signals an item in response to this SMono error signal

    If the companion sequence signals when the SMono is active, the retry attempt is suppressed and any terminal signal will terminate the SMono source with the same signal immediately.

    whenFactory

    the Function1 providing a SFlux signalling any error from the source sequence and returning a Publisher companion.

    returns

    a re-subscribing SMono on onError when the companion Publisher produces an onNext signal

  76. final def single(): SMono[T]

    Permalink

    Expect exactly one item from this SMono source or signal java.util.NoSuchElementException for an empty source.

    Expect exactly one item from this SMono source or signal java.util.NoSuchElementException for an empty source.

    Note Mono doesn't need SFlux.single(AnyRef), since it is equivalent to SMono.defaultIfEmpty(AnyRef) in a SMono.

    returns

    a SMono with the single item or an error signal

  77. def subscribe(s: Subscriber[_ >: T]): Unit

    Permalink
    Definition Classes
    SMono → Publisher
  78. final def subscribe(consumer: (T) ⇒ Unit, errorConsumer: (Throwable) ⇒ Unit, completeConsumer: ⇒ Unit, subscriptionConsumer: (Subscription) ⇒ Unit): Disposable

    Permalink

    Subscribe consumer to this SMono that will consume all the sequence.

    Subscribe consumer to this SMono that will consume all the sequence.

    For a passive version that observe and forward incoming data see SMono.doOnSuccess and SMono.doOnError.

    consumer

    the consumer to invoke on each value

    errorConsumer

    the consumer to invoke on error signal

    completeConsumer

    the consumer to invoke on complete signal

    subscriptionConsumer

    the consumer to invoke on subscribe signal, to be used for the initial request, or null for max request

    returns

    a new Disposable to dispose the Subscription

  79. final def subscribe(consumer: (T) ⇒ Unit, errorConsumer: (Throwable) ⇒ Unit, completeConsumer: ⇒ Unit): Disposable

    Permalink

    Subscribe consumer to this SMono that will consume all the sequence.

    Subscribe consumer to this SMono that will consume all the sequence.

    For a passive version that observe and forward incoming data see SMono.doOnSuccess and SMono.doOnError.

    consumer

    the consumer to invoke on each value

    errorConsumer

    the consumer to invoke on error signal

    completeConsumer

    the consumer to invoke on complete signal

    returns

    a new Disposable to dispose the Subscription

  80. final def subscribe(consumer: (T) ⇒ Unit, errorConsumer: (Throwable) ⇒ Unit): Disposable

    Permalink

    Subscribe Consumer to this SMono that will consume all the sequence.

    Subscribe Consumer to this SMono that will consume all the sequence.

    For a passive version that observe and forward incoming data see SMono.doOnSuccess and SMono.doOnError.

    consumer

    the consumer to invoke on each next signal

    errorConsumer

    the consumer to invoke on error signal

    returns

    a new Runnable to dispose the org.reactivestreams.Subscription

  81. final def subscribe(consumer: (T) ⇒ Unit): Disposable

    Permalink

    Subscribe a Consumer to this SMono that will consume all the sequence.

    Subscribe a Consumer to this SMono that will consume all the sequence.

    For a passive version that observe and forward incoming data see SMono.doOnSuccess and SMono.doOnError.

    consumer

    the consumer to invoke on each value

    returns

    a new Runnable to dispose the Subscription

  82. final def subscribe(): Disposable

    Permalink

    Subscribe to this SMono and request unbounded demand.

    Subscribe to this SMono and request unbounded demand.

    This version doesn't specify any consumption behavior for the events from the chain, especially no error handling, so other variants should usually be preferred.

    returns

    a new Disposable that can be used to cancel the underlying Subscription

  83. final def subscribeOn(scheduler: Scheduler): SMono[T]

    Permalink

    Run the requests to this Publisher SMono on a given worker assigned by the supplied Scheduler.

    Run the requests to this Publisher SMono on a given worker assigned by the supplied Scheduler.

    mono.subscribeOn(Schedulers.parallel()).subscribe())

    scheduler

    a checked reactor.core.scheduler.Scheduler.Worker factory

    returns

    an asynchronously requesting SMono

  84. final def subscribeWith[E <: Subscriber[_ >: T]](subscriber: E): E

    Permalink

    Subscribe the given Subscriber to this SMono and return said Subscriber (eg.

    Subscribe the given Subscriber to this SMono and return said Subscriber (eg. a reactor.core.publisher.MonoProcessor.

    E

    the reified type of the Subscriber for chaining

    subscriber

    the Subscriber to subscribe with

    returns

    the passed Subscriber after subscribing it to this SMono

  85. final def subscriberContext(doOnContext: (Context) ⇒ Context): SMono[T]

    Permalink

    Enrich a potentially empty downstream Context by applying a Function1 to it, producing a new Context that is propagated upstream.

    Enrich a potentially empty downstream Context by applying a Function1 to it, producing a new Context that is propagated upstream.

    The Context propagation happens once per subscription (not on each onNext): it is done during the subscribe(Subscriber) phase, which runs from the last operator of a chain towards the first.

    So this operator enriches a Context coming from under it in the chain (downstream, by default an empty one) and passes the new enriched Context to operators above it in the chain (upstream, by way of them using Flux#subscribe(Subscriber,Context)).

    doOnContext

    the function taking a previous Context state and returning a new one.

    returns

    a contextualized SMono

    See also

    Context

  86. final def subscriberContext(mergeContext: Context): SMono[T]

    Permalink

    Enrich a potentially empty downstream Context by adding all values from the given Context, producing a new Context that is propagated upstream.

    Enrich a potentially empty downstream Context by adding all values from the given Context, producing a new Context that is propagated upstream.

    The Context propagation happens once per subscription (not on each onNext): it is done during the subscribe(Subscriber) phase, which runs from the last operator of a chain towards the first.

    So this operator enriches a Context coming from under it in the chain (downstream, by default an empty one) and passes the new enriched Context to operators above it in the chain (upstream, by way of them using SFlux.subscribe(Subscriber,Context)).

    mergeContext

    the Context to merge with a previous Context state, returning a new one.

    returns

    a contextualized SMono

    See also

    Context

  87. final def switchIfEmpty[U >: T](alternate: SMono[U]): SMono[U]

    Permalink

    Provide an alternative SMono if this mono is completed without data

    Provide an alternative SMono if this mono is completed without data

    alternate

    the alternate mono if this mono is empty

    returns

    an alternating SMono on source onComplete without elements

    See also

    SFlux.switchIfEmpty

  88. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  89. final def tag(key: String, value: String): SMono[T]

    Permalink

    Tag this mono with a key/value pair.

    Tag this mono with a key/value pair. These can be retrieved as a Stream of all tags throughout the publisher chain by using reactor.core.scala.Scannable.tags() (as traversed by reactor.core.scala.Scannable.parents()).

    key

    a tag key

    value

    a tag value

    returns

    the same sequence, but bearing tags

  90. final def take(duration: Duration, timer: Scheduler = Schedulers.parallel()): SMono[T]

    Permalink

    Give this Mono a chance to resolve within a specified time frame but complete if it doesn't.

    Give this Mono a chance to resolve within a specified time frame but complete if it doesn't. This works a bit like SMono.timeout(Duration) except that the resulting SMono completes rather than errors when the timer expires.

    The timeframe is evaluated using the provided Scheduler.

    duration

    the maximum duration to wait for the source Mono to resolve.

    timer

    the Scheduler on which to measure the duration.

    returns

    a new SMono that will propagate the signals from the source unless no signal is received for duration, in which case it completes.

  91. final def takeUntilOther(other: Publisher[_]): SMono[T]

    Permalink

    Give this Mono a chance to resolve before a companion Publisher emits.

    Give this Mono a chance to resolve before a companion Publisher emits. If the companion emits before any signal from the source, the resulting SMono will complete. Otherwise, it will relay signals from the source.

    other

    a companion Publisher that short-circuits the source with an onComplete signal if it emits before the source emits.

    returns

    a new SMono that will propagate the signals from the source unless a signal is first received from the companion Publisher, in which case it completes.

  92. final def then[V](other: SMono[V]): SMono[V]

    Permalink

    Ignore element from this SMono and transform its completion signal into the emission and completion signal of a provided Mono[V].

    Ignore element from this SMono and transform its completion signal into the emission and completion signal of a provided Mono[V]. Error signal is replayed in the resulting SMono[V].

    V

    the element type of the supplied Mono

    other

    a SMono to emit from after termination

    returns

    a new SMono that emits from the supplied SMono

  93. final def then(): SMono[Unit]

    Permalink

    Return an SMono[Unit] which only replays complete and error signals from this SMono.

    Return an SMono[Unit] which only replays complete and error signals from this SMono.

    returns

    a SMono ignoring its payload (actively dropping)

  94. final def thenEmpty(other: MapablePublisher[Unit]): SMono[Unit]

    Permalink

    Return a SMono[Unit] that waits for this SMono to complete then for a supplied Publisher[Unit] to also complete.

    Return a SMono[Unit] that waits for this SMono to complete then for a supplied Publisher[Unit] to also complete. The second completion signal is replayed, or any error signal that occurs instead.

    other

    a Publisher to wait for after this Mono's termination

    returns

    a new SMono completing when both publishers have completed in sequence

  95. final def thenMany[V](other: Publisher[V]): SFlux[V]

    Permalink

    Ignore element from this mono and transform the completion signal into a SFlux[V] that will emit elements from the provided Publisher.

    Ignore element from this mono and transform the completion signal into a SFlux[V] that will emit elements from the provided Publisher.

    V

    the element type of the supplied Publisher

    other

    a Publisher to emit from after termination

    returns

    a new SMono that emits from the supplied Publisher after this SMono completes.

  96. final def timeout[U >: T](timeout: Duration, fallback: Option[SMono[U]] = None, timer: Scheduler = Schedulers.parallel()): SMono[U]

    Permalink

    Switch to a fallback SMono in case an item doesn't arrive before the given period.

    Switch to a fallback SMono in case an item doesn't arrive before the given period.

    If the given Publisher is null, signal a java.util.concurrent.TimeoutException.

    timeout

    the timeout before the onNext signal from this SMono

    fallback

    the fallback SMono to subscribe when a timeout occurs

    timer

    a time-capable Scheduler instance to run on

    returns

    an expirable SMono with a fallback SMono

  97. final def timeoutWhen[U >: T, V](firstTimeout: Publisher[V], fallback: Option[SMono[U]] = None): SMono[U]

    Permalink

    Switch to a fallback Publisher in case the item from this Mono has not been emitted before the given Publisher emits.

    Switch to a fallback Publisher in case the item from this Mono has not been emitted before the given Publisher emits.

    U

    the element type of the timeout Publisher

    firstTimeout

    the timeout Publisher that must not emit before the first signal from this SMono

    fallback

    the fallback Publisher to subscribe when a timeout occurs

    returns

    an expirable SMono with a fallback SMono if the item doesn't come before a Publisher signals

  98. final def timestamp(scheduler: Scheduler = Schedulers.parallel()): SMono[Tuple2[Long, _ <: T]]

    Permalink

    Emit a Tuple2 pair of T1 Long current system time in millis and T2 T associated data for the eventual item from this SMono

    Emit a Tuple2 pair of T1 Long current system time in millis and T2 T associated data for the eventual item from this SMono

    scheduler

    a Scheduler instance to read time from

    returns

    a timestamped SMono

  99. final def toFuture: Future[T]

    Permalink

    Transform this SMono into a Future completing on onNext or onComplete and failing on onError.

    Transform this SMono into a Future completing on onNext or onComplete and failing on onError.

    returns

    a Future

  100. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  101. final def transform[V](transformer: (SMono[T]) ⇒ Publisher[V]): SMono[V]

    Permalink

    Transform this SMono in order to generate a target SMono.

    Transform this SMono in order to generate a target SMono. Unlike SMono.compose, the provided function is executed as part of assembly.

    V

    the item type in the returned SMono

    transformer

    the Function1 to immediately map this SMono into a target SMono instance.

    returns

    a new SMono

    Example:
    1. val applySchedulers = mono => mono.subscribeOn(Schedulers.elastic()).publishOn(Schedulers.parallel());
      mono.transform(applySchedulers).map(v => v * v).subscribe()
    See also

    SMono.as for a loose conversion to an arbitrary type

    SMono.compose for deferred composition of SMono for each Subscriber

  102. final def transformDeferred[V](transformer: (SMono[T]) ⇒ Publisher[V]): SMono[V]

    Permalink

    Defer the given transformation to this SMono in order to generate a target SMono type.

    Defer the given transformation to this SMono in order to generate a target SMono type. A transformation will occur for each org.reactivestreams.Subscriber.

    mono.transformDeferred(SMono::fromPublisher).subscribe()

    V

    the item type in the returned org.reactivestreams.Publisher

    transformer

    the function to lazily map this SMono into a target SMono instance.

    returns

    a new SMono

    See also

    SMono.as for a loose conversion to an arbitrary type

  103. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  104. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  105. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. final def cast[E](clazz: Class[E]): SMono[E]

    Permalink

    Cast the current SMono produced type into a target produced type.

    Cast the current SMono produced type into a target produced type.

    E

    the SMono output type

    clazz

    the target type to cast to

    returns

    a casted SMono

    Annotations
    @deprecated
    Deprecated

    (Since version reactor-scala-extensions 0.5.0) Use the other cast signature instead

  2. final def compose[V](transformer: (SMono[T]) ⇒ Publisher[V]): SMono[V]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version reactor-scala-extensions 0.5.0 reactor-core 3.3.0) will be removed, use transformDeferred() instead

  3. final def doAfterSuccessOrError(afterTerminate: (Try[_ <: T]) ⇒ Unit): SMono[T]

    Permalink

    Triggered after the SMono terminates, either by completing downstream successfully or with an error.

    Triggered after the SMono terminates, either by completing downstream successfully or with an error. The arguments will be null depending on success, success with data and error:

    • null, null : completed without data
    • T, null : completed with data
    • null, Throwable : failed with/without data

    afterTerminate

    the callback to call after org.reactivestreams.Subscriber.onNext, org.reactivestreams.Subscriber.onComplete without preceding org.reactivestreams.Subscriber.onNext or org.reactivestreams.Subscriber.onError

    returns

    a new SMono

    Annotations
    @deprecated
    Deprecated

    (Since version reactor-scala-extensions 0.5.0, reactor-core 3.3.0) prefer using doAfterTerminate or doFinally. will be removed

  4. final def ofType[U](clazz: Class[U]): SMono[U]

    Permalink

    Evaluate the accepted value against the given Class type.

    Evaluate the accepted value against the given Class type. If the predicate test succeeds, the value is passed into the new SMono. If the predicate test fails, the value is ignored.

    clazz

    the Class type to test values against

    returns

    a new SMono reduced to items converted to the matched type

    Annotations
    @deprecated
    Deprecated

    (Since version reactor-scala-extensions 0.5.0) Use the other ofType signature instead

Inherited from MapablePublisher[T]

Inherited from Publisher[T @scala.annotation.unchecked.uncheckedVariance]

Inherited from SMonoLike[T]

Inherited from ScalaConverters

Inherited from AnyRef

Inherited from Any

Ungrouped