Class/Object

reactor.core.scala.publisher

Mono

Related Docs: object Mono | package publisher

Permalink

class Mono[T] extends Publisher[T] with MapablePublisher[T]

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 Mono type to preserve the "at most one" property of the resulting Mono. For instance flatMap returns a Flux with possibly more than 1 emission. Its alternative enforcing Mono input is then.

Mono[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

Flux

Linear Supertypes
MapablePublisher[T], Publisher[T], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Mono
  2. MapablePublisher
  3. Publisher
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

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 ++[T2](other: Mono[_ <: T2]): Mono[(T, T2)]

    Permalink

    An alias for Mono.and

    An alias for Mono.and

    T2

    the element type of the other Mono instance

    other

    the Mono to combine with

    returns

    a new combined Mono

    See also

    Mono.when

  4. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  5. final def and[T2, O](rightGenerator: (T) ⇒ Mono[T2], combinator: (T, T2) ⇒ O): Mono[O]

    Permalink

    Wait for the result from this mono, use it to create a second mono via the provided rightGenerator function and combine both results into an arbitrary O object, as defined by the provided combinator function.

    Wait for the result from this mono, use it to create a second mono via the provided rightGenerator function and combine both results into an arbitrary O object, as defined by the provided combinator function.

    T2

    the element type of the other Mono instance

    O

    the element type of the combination

    rightGenerator

    the scala.Function1 to generate a Mono to combine with

    combinator

    a scala.Function2 combinator function when both sources complete

    returns

    a new combined Mono

  6. final def and[T2](rightGenerator: (T) ⇒ Mono[T2]): Mono[(T, T2)]

    Permalink

    Wait for the result from this mono, use it to create a second mono via the provided rightGenerator function and combine both results into a scala.Tuple2.

    Wait for the result from this mono, use it to create a second mono via the provided rightGenerator function and combine both results into a scala.Tuple2.

    T2

    the element type of the other Mono instance

    rightGenerator

    the scala.Function1 to generate a Mono to combine with

    returns

    a new combined Mono

  7. final def and[T2, O](other: Mono[T2], combinator: (T, T2) ⇒ O): Mono[O]

    Permalink

    Combine the result from this mono and another into an arbitrary O object, as defined by the provided combinator function.

    Combine the result from this mono and another into an arbitrary O object, as defined by the provided combinator function.

    T2

    the element type of the other Mono instance

    O

    the element type of the combination

    other

    the Mono to combine with

    combinator

    a scala.Function2 combinator function when both sources complete

    returns

    a new combined Mono

    See also

    Mono.when

  8. final def and[T2](other: Mono[_ <: T2]): Mono[(T, T2)]

    Permalink

    Combine the result from this mono and another into a scala.Tuple2.

    Combine the result from this mono and another into a scala.Tuple2.

    T2

    the element type of the other Mono instance

    other

    the Mono to combine with

    returns

    a new combined Mono

    See also

    Mono.when

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

    Permalink

    Transform this Mono into a target type.

    Transform this Mono 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 { @link Mono} to instance P

    See also

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

  10. final def asInstanceOf[T0]: T0

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

    Permalink
  12. final def awaitOnSubscribe(): Mono[T]

    Permalink

    Intercepts the onSubscribe call and makes sure calls to Subscription methods only happen after the child Subscriber has returned from its onSubscribe method.

    Intercepts the onSubscribe call and makes sure calls to Subscription methods only happen after the child Subscriber has returned from its onSubscribe method.

    This helps with child Subscribers that don't expect a recursive call from onSubscribe into their onNext because, for example, they request immediately from their onSubscribe but don't finish their preparation before that and onNext runs into a half-prepared state. This can happen with non Reactor based Subscribers.

    returns

    non reentrant onSubscribe Mono

  13. final def block(timeout: Duration): 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

    returns

    T the result

  14. final def block(): 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.

    returns

    T the result

  15. final def cache(): Mono[T]

    Permalink

    Turn this Mono into a hot source and cache last emitted signals for further Subscriber.

    Turn this Mono into a hot source and cache last emitted signals for further Subscriber. Completion and Error will also be replayed.

    returns

    a replaying Mono

  16. final def cancelOn(scheduler: Scheduler): Mono[T]

    Permalink

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

    Prepare this Mono 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 Mono

  17. final def cast[E](clazz: Class[E]): Mono[E]

    Permalink

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

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

    E

    the { @link Mono} output type

    clazz

    the target type to cast to

    returns

    a casted Mono

  18. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def compose[V](transformer: (Mono[T]) ⇒ Publisher[V]): Mono[V]

    Permalink

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

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

    flux.compose(Mono::from).subscribe()

    V

    the item type in the returned org.reactivestreams.Publisher

    transformer

    the function to immediately map this Mono into a target Mono instance.

    returns

    a new Mono

    See also

    Mono.as for a loose conversion to an arbitrary type

  20. final def concatWith(other: Publisher[T]): Flux[T]

    Permalink

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

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

    other

    the Publisher sequence to concat after this Flux

    returns

    a concatenated Flux

  21. final def defaultIfEmpty(defaultV: T): Mono[T]

    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 Mono

    See also

    Flux.defaultIfEmpty

  22. final def delaySubscription[U](subscriptionDelay: Publisher[U]): Mono[T]

    Permalink

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

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

    U

    the other source type

    subscriptionDelay

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

    returns

    a delayed Mono

  23. final def delaySubscription(delay: Duration, timer: Scheduler): Mono[T]

    Permalink

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

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

    delay

    Duration before subscribing this Mono

    timer

    a time-capable Scheduler instance to run on

    returns

    a delayed Mono

  24. final def delaySubscription(delay: Duration): Mono[T]

    Permalink

    Delay the subscription to this Mono source until the given period elapses.

    Delay the subscription to this Mono source until the given period elapses.

    delay

    duration before subscribing this Mono

    returns

    a delayed Mono

  25. final def dematerialize[X](): Mono[X]

    Permalink

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

    A "phantom-operator" working only if this Mono 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 Mono

  26. final def doAfterTerminate(afterTerminate: Function2[_ >: T, Throwable, Unit]): Mono[T]

    Permalink

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

    Triggered after the Mono 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 Mono

  27. final def doFinally(onFinally: (SignalType) ⇒ Unit): Mono[T]

    Permalink
  28. final def doOnCancel(onCancel: () ⇒ Unit): Mono[T]

    Permalink

    Triggered when the Mono is cancelled.

    Triggered when the Mono is cancelled.

    onCancel

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

    returns

    a new Mono

  29. final def doOnError(predicate: (Throwable) ⇒ Boolean, onError: (Throwable) ⇒ Unit): Mono[T]

    Permalink

    Triggered when the Mono completes with an error matching the given exception.

    Triggered when the Mono completes with an error matching the given exception.

    predicate

    the matcher for exceptions to handle

    onError

    the error handler for each error

    returns

    an observed Mono

  30. final def doOnError[E <: Throwable](exceptionType: Class[E], onError: (E) ⇒ Unit): Mono[T]

    Permalink

    Triggered when the Mono completes with an error matching the given exception type.

    Triggered when the Mono completes with an error matching the given exception type.

    E

    type of the error to handle

    exceptionType

    the type of exceptions to handle

    onError

    the error handler for each error

    returns

    an observed Mono

  31. final def doOnError(onError: (Throwable) ⇒ Unit): Mono[T]

    Permalink

    Triggered when the Mono completes with an error.

    Triggered when the Mono completes with an error.

    onError

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

    returns

    a new Mono

  32. final def doOnNext(onNext: (T) ⇒ Unit): Mono[T]

    Permalink
  33. final def doOnRequest(consumer: (Long) ⇒ Unit): Mono[T]

    Permalink

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

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

    consumer

    the consumer to invoke on each request

    returns

    an observed Mono

  34. final def doOnSubscribe(onSubscribe: (Subscription) ⇒ Unit): Mono[T]

    Permalink

    Triggered when the Mono is subscribed.

    Triggered when the Mono is subscribed.

    onSubscribe

    the callback to call on Subscriber#onSubscribe

    returns

    a new Mono

  35. final def doOnSuccess(onSuccess: (T) ⇒ Unit): Mono[T]

    Permalink

    Triggered when the Mono completes successfully.

    Triggered when the Mono completes successfully.

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

    onSuccess

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

    returns

    a new Mono

  36. final def doOnTerminate(onTerminate: (T, Throwable) ⇒ Unit): Mono[T]

    Permalink

    Triggered when the Mono terminates, either by completing successfully or with an error.

    Triggered when the Mono terminates, either by completing successfully or with an error.

    • null, null : completing without data
    • T, null : completing with data
    • null, Throwable : failing with/without data

    onTerminate

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

    returns

    a new Mono

  37. final def elapsed(scheduler: Scheduler): Mono[(Long, T)]

    Permalink

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

    Map this Mono 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

    returns

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

  38. final def elapsed(): Mono[(Long, T)]

    Permalink

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

    Map this Mono 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.

    returns

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  41. final def filter(tester: (T) ⇒ Boolean): Mono[T]

    Permalink

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

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

    tester

    the predicate to evaluate

    returns

    a filtered Mono

  42. final def filterWhen(asyncPredicate: Function1[T, _ <: Publisher[Boolean] with MapablePublisher[Boolean]]): Mono[T]

    Permalink

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

    If this Mono 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 Mono, 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 Mono

  43. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  44. final def flatMapIterable[R](mapper: (T) ⇒ Iterable[R]): Flux[R]

    Permalink

    Transform the item emitted by this Mono into Iterable, , then forward its elements into the returned Flux.

    Transform the item emitted by this Mono into Iterable, , then forward its elements into the returned Flux. 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 Flux

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

    Permalink

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

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

    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 Flux as the sequence is not guaranteed to be single at most

    See also

    Flux.flatMap

  46. final def flatMapMany[R](mapper: (T) ⇒ Publisher[R]): Flux[R]

    Permalink

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

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

    R

    the merged sequence type

    mapper

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

    returns

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

  47. final def flux(): Flux[T]

    Permalink

    Convert this Mono to a Flux

    Convert this Mono to a Flux

    returns

    a Flux variant of this Mono

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

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

    Permalink

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

    Handle the items emitted by this Mono 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 Mono

  50. final def hasElement: Mono[Boolean]

    Permalink

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

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

    returns

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

  51. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  52. final def hide: Mono[T]

    Permalink

    Hides the identity of this Mono instance.

    Hides the identity of this Mono instance.

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

    returns

    a new Mono instance

  53. final def ignoreElement: Mono[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 Mono.

  54. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  55. implicit def jMonoVoid2jMonoUnit(jMonoVoid: publisher.Mono[Void]): publisher.Mono[Unit]

    Permalink
  56. val javaTupleLongAndT2ScalaTupleLongAndT: Function[Tuple2[Long, T], (Long, T)]

    Permalink
  57. final def log(category: String, level: Level, showOperatorLine: Boolean, options: SignalType*): Mono[T]

    Permalink
  58. final def log(category: String, level: Level, options: SignalType*): Mono[T]

    Permalink
  59. final def log(category: String): Mono[T]

    Permalink
  60. final def log: Mono[T]

    Permalink
  61. final def map[R](mapper: (T) ⇒ R): Mono[R]

    Permalink
    Definition Classes
    MonoMapablePublisher
  62. final def materialize(): Mono[Signal[T]]

    Permalink

    Transform the incoming onNext, onError and onComplete signals into Signal.

    Transform the incoming onNext, onError and onComplete signals into Signal. 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.

    returns

    a Mono of materialized Signal

  63. final def mergeWith(other: Publisher[_ <: T]): Flux[T]

    Permalink

    Merge emissions of this Mono with the provided Publisher.

    Merge emissions of this Mono with the provided Publisher.

    other

    the other Publisher to merge with

    returns

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  67. final def ofType[U](clazz: Class[U]): Mono[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 Mono. If the predicate test fails, the value is ignored.

    clazz

    the Class type to test values against

    returns

    a new Mono reduced to items converted to the matched type

  68. final def onErrorMap(predicate: (Throwable) ⇒ Boolean, mapper: (Throwable) ⇒ Throwable): Mono[T]

    Permalink

    Transform the error emitted by this Mono by applying a function if the error matches the given predicate, otherwise let the error flow.

    Transform the error emitted by this Mono by applying a function if the error matches the given predicate, otherwise let the error flow.

    predicate

    the error predicate

    mapper

    the error transforming Function1

    returns

    a transformed Mono

  69. final def onErrorMap[E <: Throwable](type: Class[E], mapper: (E) ⇒ Throwable): Mono[T]

    Permalink

    Transform the error emitted by this Mono by applying a function if the error matches the given type, otherwise let the error flow.

    Transform the error emitted by this Mono by applying a function if the error matches the given type, otherwise let the error flow.

    E

    the error type

    type

    the type to match

    mapper

    the error transforming Function1

    returns

    a transformed Mono

  70. final def onErrorMap(mapper: (Throwable) ⇒ Throwable): Mono[T]

    Permalink

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

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

    mapper

    the error transforming Function1

    returns

    a transformed Mono

  71. final def onErrorResume(predicate: (Throwable) ⇒ Boolean, fallback: (Throwable) ⇒ Mono[_ <: T]): Mono[T]

    Permalink

    Subscribe to a returned fallback publisher when an error matching the given predicate occurs.

    Subscribe to a returned fallback publisher when an error matching the given predicate occurs.

    predicate

    the error predicate to match

    fallback

    the Function1 mapping the error to a new Mono sequence

    returns

    a new Mono

    See also

    Flux#onErrorResume

  72. final def onErrorResume[E <: Throwable](type: Class[E], fallback: (E) ⇒ Mono[_ <: T]): Mono[T]

    Permalink

    Subscribe to a returned fallback publisher when an error matching the given type occurs.

    Subscribe to a returned fallback publisher when an error matching the given type occurs.

    E

    the error type

    type

    the error type to match

    fallback

    the Function1 mapping the error to a new Mono sequence

    returns

    a new Mono

    See also

    Flux.onErrorResume

  73. final def onErrorResume(fallback: (Throwable) ⇒ Mono[_ <: T]): Mono[T]

    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 { @link Mono}

    returns

    an alternating Mono on source onError

    See also

    Flux.onErrorResume

  74. final def onErrorReturn(predicate: (Throwable) ⇒ Boolean, fallbackValue: T): Mono[T]

    Permalink

    Simply emit a captured fallback value when an error matching the given predicate is observed on this Mono.

    Simply emit a captured fallback value when an error matching the given predicate is observed on this Mono.

    predicate

    the error predicate to match

    fallbackValue

    the value to emit if a matching error occurs

    returns

    a new Mono

  75. final def onErrorReturn[E <: Throwable](type: Class[E], fallbackValue: T): Mono[T]

    Permalink

    Simply emit a captured fallback value when an error of the specified type is observed on this Mono.

    Simply emit a captured fallback value when an error of the specified type is observed on this Mono.

    E

    the error type

    type

    the error type to match

    fallbackValue

    the value to emit if a matching error occurs

    returns

    a new falling back Mono

  76. final def onErrorReturn(fallback: T): Mono[T]

    Permalink

    Simply emit a captured fallback value when any error is observed on this Mono.

    Simply emit a captured fallback value when any error is observed on this Mono.

    fallback

    the value to emit if an error occurs

    returns

    a new falling back Mono

  77. final def onTerminateDetach(): Mono[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 Mono

  78. final def or(other: Mono[_ <: T]): Mono[T]

    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 { @link Mono} to compete with for the result

    returns

    a new Mono

    See also

    Mono.first

  79. final def publish[R](transform: (Mono[T]) ⇒ Mono[R]): Mono[R]

    Permalink

    Shares a Mono 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 Mono 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 tranformation function

    returns

    a new Mono

  80. final def publishOn(scheduler: Scheduler): Mono[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 Mono

  81. final def repeat(numRepeat: Long, predicate: () ⇒ Boolean): Flux[T]

    Permalink

    Repeatedly subscribe to the source if the predicate returns true after completion of the previous subscription.

    Repeatedly subscribe to the source if the predicate returns true after completion of the previous subscription. A specified maximum of repeat will limit the number of re-subscribe.

    numRepeat

    the number of times to re-subscribe on complete

    predicate

    the boolean to evaluate on onComplete

    returns

    an eventually repeated Flux on onComplete up to number of repeat specified OR matching predicate

  82. final def repeat(numRepeat: Long): Flux[T]

    Permalink

    Repeatedly subscribe to the source if the predicate returns true after completion of the previous subscription.

    Repeatedly subscribe to the source if the predicate returns true after completion of the previous subscription.

    numRepeat

    the number of times to re-subscribe on onComplete

    returns

    an eventually repeated Flux on onComplete up to number of repeat specified

  83. final def repeat(predicate: () ⇒ Boolean): Flux[T]

    Permalink

    Repeatedly subscribe to the source if the predicate returns true after completion of the previous subscription.

    Repeatedly subscribe to the source if the predicate returns true after completion of the previous subscription.

    predicate

    the boolean to evaluate on onComplete.

    returns

    an eventually repeated Flux on onComplete

  84. final def repeat(): Flux[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 Flux on onComplete

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

    Permalink

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

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

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

    whenFactory

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

    returns

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

  86. final def repeatWhenEmpty(maxRepeat: Int, repeatFactory: (Flux[Long]) ⇒ Publisher[_]): Mono[T]

    Permalink

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

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

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

    Emits an IllegalStateException if the max repeat is exceeded and different from Int.MaxValue.

    maxRepeat

    the maximum repeat number of time (infinite if Int.MaxValue)

    repeatFactory

    the Function1 providing a Flux signalling the current repeat index from 0 on onComplete and returning a { @link Publisher} companion.

    returns

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

  87. final def repeatWhenEmpty(repeatFactory: (Flux[Long]) ⇒ Publisher[_]): Mono[T]

    Permalink

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

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

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

    repeatFactory

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

    returns

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

  88. final def retry(numRetries: Long, retryMatcher: (Throwable) ⇒ Boolean): Mono[T]

    Permalink

    Re-subscribes to this Mono sequence up to the specified number of retries if it signals any error and the given Predicate matches otherwise push the error downstream.

    Re-subscribes to this Mono sequence up to the specified number of retries if it signals any error and the given Predicate matches otherwise push the error downstream.

    numRetries

    the number of times to tolerate an error

    retryMatcher

    the predicate to evaluate if retry should occur based on a given error signal

    returns

    a re-subscribing Mono on onError up to the specified number of retries and if the predicate matches.

  89. final def retry(retryMatcher: (Throwable) ⇒ Boolean): Mono[T]

    Permalink

    Re-subscribes to this Mono sequence if it signals any error and the given Predicate matches otherwise push the error downstream.

    Re-subscribes to this Mono sequence if it signals any error and the given Predicate matches otherwise push the error downstream.

    retryMatcher

    the predicate to evaluate if retry should occur based on a given error signal

    returns

    a re-subscribing Mono on onError if the predicates matches.

  90. final def retry(numRetries: Long): Mono[T]

    Permalink

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

    Re-subscribes to this Mono 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 Mono on onError up to the specified number of retries.

  91. final def retry(): Mono[T]

    Permalink

    Re-subscribes to this Mono sequence if it signals any error either indefinitely.

    Re-subscribes to this Mono sequence if it signals any error either indefinitely.

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

    returns

    a re-subscribing Mono on onError

  92. final def retryWhen(whenFactory: (Flux[Throwable]) ⇒ Publisher[_]): Mono[T]

    Permalink

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

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

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

    whenFactory

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

    returns

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

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

    Permalink

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

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

    For a passive version that observe and forward incoming data see Mono.doOnSuccess and Mono.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

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

    Permalink

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

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

    For a passive version that observe and forward incoming data see Mono.doOnSuccess and Mono.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

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

    Permalink

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

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

    For a passive version that observe and forward incoming data see Mono.doOnSuccess and Mono.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

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

    Permalink

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

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

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

    consumer

    the consumer to invoke on each value

    returns

    a new Runnable to dispose the Subscription

  97. final def subscribe(): MonoProcessor[T]

    Permalink

    Start the chain and request unbounded demand.

    Start the chain and request unbounded demand.

    returns

    a Runnable task to execute to dispose and cancel the underlying Subscription

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

    Permalink
    Definition Classes
    Mono → Publisher
  99. final def subscribeOn(scheduler: Scheduler): Mono[T]

    Permalink

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

    Run the requests to this Publisher Mono 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 Mono

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

    Permalink

    Subscribe the Mono with the givne Subscriber and return it.

    Subscribe the Mono with the givne Subscriber and return it.

    subscriber

    the Subscriber to subscribe

    returns

    the passed { @link Subscriber} after subscribing it to this { @link Mono}

  101. final def switchIfEmpty(alternate: Mono[_ <: T]): Mono[T]

    Permalink

    Provide an alternative Mono if this mono is completed without data

    Provide an alternative Mono if this mono is completed without data

    alternate

    the alternate mono if this mono is empty

    returns

    an alternating Mono on source onComplete without elements

    See also

    Flux.switchIfEmpty

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

    Permalink
    Definition Classes
    AnyRef
  103. final def then[V](other: Mono[V]): Mono[V]

    Permalink

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

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

    V

    the element type of the supplied Mono

    other

    a Mono to emit from after termination

    returns

    a new Mono that emits from the supplied Mono

  104. final def then[R](transformer: (T) ⇒ Mono[R]): Mono[R]

    Permalink

    Convert the value of Mono to another Mono possibly with another value type.

    Convert the value of Mono to another Mono possibly with another value type.

    R

    the result type bound

    transformer

    the function to dynamically bind a new Mono

    returns

    a new Mono containing the merged values

    Note

    in 3.1.0.M1 this method will be renamed flatMap. However, until then the behavior of Mono.flatMap remains the current one, so it is not yet possible to anticipate this migration.

  105. final def then(): Mono[Unit]

    Permalink

    Return a Mono[Unit] which only replays complete and error signals from this Mono.

    Return a Mono[Unit] which only replays complete and error signals from this Mono.

    returns

    a Mono igoring its payload (actively dropping)

  106. final def thenEmpty(other: Publisher[Unit]): Mono[Unit]

    Permalink

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

    Return a Mono[Unit] that waits for this Mono 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 Mono completing when both publishers have completed in sequence

  107. final def thenMany[V](other: Publisher[V]): Flux[V]

    Permalink

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

    Ignore element from this mono and transform the completion signal into a Flux[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 Flux that emits from the supplied Publisher after this Mono completes.

  108. final def timeout[U](firstTimeout: Publisher[U], fallback: Mono[_ <: T]): Mono[T]

    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. The following items will be individually timed via the factory provided Publisher.

    U

    the element type of the timeout Publisher

    firstTimeout

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

    fallback

    the fallback Publisher to subscribe when a timeout occurs

    returns

    a first then per-item expirable Mono with a fallback Publisher

  109. final def timeout[U](firstTimeout: Publisher[U]): Mono[T]

    Permalink

    Signal a java.util.concurrent.TimeoutException in case the item from this Mono has not been emitted before the given Publisher emits.

    Signal a java.util.concurrent.TimeoutException 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 Mono

    returns

    an expirable Mono if the first item does not come before a Publisher signal

  110. final def timeout(timeout: Duration, fallback: Option[Mono[_ <: T]], timer: Scheduler): Mono[T]

    Permalink

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

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

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

    timeout

    the timeout before the onNext signal from this Mono

    fallback

    the fallback Mono to subscribe when a timeout occurs

    timer

    a time-capable Scheduler instance to run on

    returns

    an expirable Mono with a fallback Mono

  111. final def timeout(timeout: Duration, timer: Scheduler): Mono[T]

    Permalink

    Signal a java.util.concurrent.TimeoutException error in case an item doesn't arrive before the given period.

    Signal a java.util.concurrent.TimeoutException error in case an item doesn't arrive before the given period.

    timeout

    the timeout before the onNext signal from this Mono

    timer

    a time-capable Scheduler instance to run on

    returns

    an expirable Mono

  112. final def timeout(timeout: Duration, fallback: Option[Mono[_ <: T]]): Mono[T]

    Permalink

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

    Switch to a fallback Mono 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 Mono

    fallback

    the fallback Mono to subscribe when a timeout occurs

    returns

    an expirable Mono with a fallback Mono

  113. final def timeout(timeout: Duration): Mono[T]

    Permalink

    Signal a java.util.concurrent.TimeoutException in case an item doesn't arrive before the given period.

    Signal a java.util.concurrent.TimeoutException in case an item doesn't arrive before the given period.

    timeout

    the timeout before the onNext signal from this Mono

    returns

    an expirable Mono}

  114. final def timestamp(scheduler: Scheduler): Mono[(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 Mono

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

    scheduler

    a Scheduler instance to read time from

    returns

    a timestamped Mono

  115. final def timestamp(): Mono[(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 Mono

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

    returns

    a timestamped Mono

  116. final def toFuture: Future[T]

    Permalink

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

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

    returns

    a Future

  117. def toString(): String

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

    Permalink

    Transform this Mono in order to generate a target Mono.

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

    V

    the item type in the returned Mono

    transformer

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

    returns

    a new Mono

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

    Mono.as for a loose conversion to an arbitrary type

    Mono.compose for deferred composition of Mono for each Subscriber

  119. def untilOther(anyPublisher: Publisher[_]): Mono[T]

    Permalink

    Subscribe to this Mono and another Publisher, which will be used as a trigger for the emission of this Mono's element.

    Subscribe to this Mono and another Publisher, which will be used as a trigger for the emission of this Mono's element. That is to say, this Mono's element is delayed until the trigger Publisher emits for the first time (or terminates empty).

    anyPublisher

    the publisher which first emission or termination will trigger the emission of this Mono's value.

    returns

    this Mono, but delayed until the given publisher emits first or terminates.

  120. def untilOtherDelayError(anyPublisher: Publisher[_]): Mono[T]

    Permalink

    Subscribe to this Mono and another Publisher, which will be used as a trigger for the emission of this Mono's element, mapped through a provided function.

    Subscribe to this Mono and another Publisher, which will be used as a trigger for the emission of this Mono's element, mapped through a provided function. That is to say, this Mono's element is delayed until the trigger Publisher emits for the first time (or terminates empty). Any error is delayed until all publishers have triggered, and multiple errors are combined into one.

    anyPublisher

    the publisher which first emission or termination will trigger the emission of this Mono's value.

    returns

    this Mono, but delayed until the given publisher emits first or terminates.

  121. final def wait(): Unit

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

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

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

Inherited from MapablePublisher[T]

Inherited from Publisher[T]

Inherited from AnyRef

Inherited from Any

Ungrouped