Multiply element of this SMono with element of the other one.
Adding element of this SMono with the element of the other one.
Alias for SMono.concatWith
Alias for SMono.concatWith
Subtract element in this SMono with the element of the other one
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
the Publisher to wait for complete
a new combined SMono
Transform this SMono into a target type.
Transform this SMono into a target type.
mono.as(Flux::from).subscribe()
the returned instance type
the { @link Function} applying this { @link Mono}
the transformed SMono to instance P
SMono.compose for a bounded conversion to org.reactivestreams.Publisher
Get the underlying reactor.core.publisher.Mono
Get the underlying reactor.core.publisher.Mono
reactor.core.publisher.Mono
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.
maximum time period to wait for before raising a RuntimeException. Defaulted to Duration.Inf
T the result
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.
maximum time period to wait for before raising a RuntimeException. Defaulted to Duration.Inf
T the result
Turn this SMono into a hot source and cache last emitted signals for further Subscriber, with an expiry timeout.
Prepare this SMono so that subscribers will cancel from it on a specified reactor.core.scheduler.Scheduler.
Cast the current SMono produced type into a target produced type.
Concatenate emissions of this SMono with the provided Publisher (no interleave).
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
the alternate value if this sequence is empty
a new SMono
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.
Duration by which to delay the Subscriber.onNext signal
a time-capable Scheduler instance to delay the value signal on
a delayed SMono
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.
the other source type
a Publisher to signal by next or complete this SMono.subscribe
a delayed SMono
Delay the subscription to this SMono source until the given Duration elapses.
Delay the subscription to this SMono source until the given Duration elapses.
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.
a Function1 that maps this Mono's value into a Publisher whose termination will trigger relaying the value.
this SMono, but delayed until the derived publisher terminates.
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.
the dematerialized type
a dematerialized SMono
Add behavior (side-effect) triggered after the SMono terminates, either by completing downstream successfully or with an error.
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().
the callback to execute after a terminal signal (complete, error or cancel)
an observed SMono
Triggered when the SMono is cancelled.
Triggered when the SMono completes with an error.
Add behavior triggered when the SMono emits a data successfully.
Attach a Long consumer
to this SMono that will observe any request to this SMono.
Triggered when the SMono is subscribed.
Triggered when the SMono completes successfully.
Triggered when the SMono completes successfully.
Add behavior triggered when the SMono terminates, either by completing successfully or with an error.
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.
the Scheduler to read time from. Defaulted to Schedulers.parallel()
a transforming SMono that emits a tuple of time elapsed in milliseconds and matching data
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
the Function1 applied at each level of recursion to expand values into a Publisher, producing a graph.
a capacity hint to prepare the inner queues to accommodate n elements per level of recursion.
this Mono expanded breadth-first to a SFlux
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
the Function1 applied at each level of recursion to expand values into a Publisher, producing a graph.
a capacity hint to prepare the inner queues to accommodate n elements per level of recursion.
this Mono expanded depth-first to a SFlux
Test the result if any of this SMono and replay it if predicate returns true.
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.
the function generating a Publisher of Boolean to filter the Mono with
a filtered SMono
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 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.
the merged output sequence type
the Function1 to transform input item into a sequence Iterable
a merged SFlux
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.
the type of the produced inner sequence
the Function1 to call on next data and returning a sequence to merge
theFunction1 to call on error signal and returning a sequence to merge
the Function1 to call on complete signal and returning a sequence to merge
a new SFlux as the sequence is not guaranteed to be single at most
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.
the merged sequence type
the Function1 to produce a sequence of R from the the eventual passed Subscriber.onNext
a new SFlux as the sequence is not guaranteed to be single at most
Handle the items emitted by this SMono by calling a biconsumer with the output sink for each onNext.
Emit a single boolean true if this SMono has an element.
Hides the identity of this SMono instance.
Ignores onNext signal (dropping it) and only reacts on termination.
Ignores onNext signal (dropping it) and only reacts on termination.
a new completable SMono.
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]]
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.
the transformed type
the synchronous transforming Function1
a new SMono
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.
a SMono of materialized Signal
SMono.dematerialize()
Merge emissions of this SMono with the provided Publisher.
Activate metrics for this sequence, provided there is an instrumentation facade on the classpath (otherwise this method is a pure no-op).
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.
a name for the sequence
the same sequence, but bearing a name
Evaluate the accepted value against the given Class type.
Transform the error emitted by this SMono by applying a function.
Subscribe to a returned fallback publisher when any error occurs.
Subscribe to a returned fallback publisher when any error occurs.
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.
a detachable SMono
Emit the any of the result from this mono or from the given mono
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.
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()
a checked { @link reactor.core.scheduler.Scheduler.Worker} factory
an asynchronously producing SMono
Repeatedly subscribe to the source completion of the previous subscription.
Repeatedly subscribe to the source completion of the previous subscription.
an indefinitively repeated SFlux on onComplete
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.
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.
Re-subscribes to this SMono sequence if it signals any error either indefinitely or a fixed number of times.
Retries this SMono when a companion sequence signals an item in response to this SMono error signal
Expect exactly one item from this SMono source or signal java.util.NoSuchElementException for an empty source.
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.
the consumer to invoke on each value
the consumer to invoke on error signal
the consumer to invoke on complete signal
the consumer to invoke on subscribe signal, to be used for the initial request, or null for max request
a new Disposable to dispose the Subscription
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.
the consumer to invoke on each value
the consumer to invoke on error signal
the consumer to invoke on complete signal
a new Disposable to dispose the Subscription
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.
the consumer to invoke on each next signal
the consumer to invoke on error signal
a new Runnable to dispose the org.reactivestreams.Subscription
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.
the consumer to invoke on each value
a new Runnable to dispose the Subscription
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.
a new Disposable that can be used to cancel the underlying Subscription
Run the requests to this Publisher SMono on a given worker assigned by the supplied Scheduler.
Subscribe the given Subscriber to this SMono and return said Subscriber (eg.
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)
).
the function taking a previous Context state and returning a new one.
a contextualized SMono
Context
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)).
the Context to merge with a previous Context state, returning a new one.
a contextualized SMono
Context
Provide an alternative SMono if this mono is completed without data
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()).
a tag key
a tag value
the same sequence, but bearing tags
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.
the maximum duration to wait for the source Mono to resolve.
the Scheduler on which to measure the duration.
a new SMono that will propagate the signals from the source unless
no signal is received for duration
, in which case it completes.
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.
a companion Publisher that short-circuits the source with an onComplete signal if it emits before the source emits.
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.
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]
.
Return an SMono[Unit]
which only replays complete and error signals
from this SMono.
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.
a Publisher to wait for after this Mono's termination
a new SMono completing when both publishers have completed in sequence
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.
the element type of the supplied Publisher
a Publisher to emit from after termination
a new SMono that emits from the supplied Publisher after this SMono completes.
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.
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.
Emit a Tuple2 pair of T1 Long current system time in
millis and T2 T
associated data for the eventual item from this SMono
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.
a Future
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.
the item type in the returned SMono
the Function1 to immediately map this SMono into a target SMono instance.
a new SMono
val applySchedulers = mono => mono.subscribeOn(Schedulers.elastic()).publishOn(Schedulers.parallel()); mono.transform(applySchedulers).map(v => v * v).subscribe()
SMono.as for a loose conversion to an arbitrary type
SMono.compose for deferred composition of SMono for each Subscriber
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()
the item type in the returned org.reactivestreams.Publisher
the function to lazily map this SMono into a target SMono instance.
a new SMono
SMono.as for a loose conversion to an arbitrary type
Cast the current SMono produced type into a target produced type.
(Since version reactor-scala-extensions 0.5.0 reactor-core 3.3.0) will be removed, use transformDeferred() instead
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:
the callback to call after org.reactivestreams.Subscriber.onNext, org.reactivestreams.Subscriber.onComplete without preceding org.reactivestreams.Subscriber.onNext or org.reactivestreams.Subscriber.onError
a new SMono
(Since version reactor-scala-extensions 0.5.0, reactor-core 3.3.0) prefer using doAfterTerminate
or doFinally
. will be removed
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.
the Class type to test values against
a new SMono reduced to items converted to the matched type
(Since version reactor-scala-extensions 0.5.0) Use the other ofType signature instead
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.the type of the single value of this class
SFlux