public class MultiOnItem<T> extends Object
| Constructor and Description |
|---|
MultiOnItem(Multi<T> upstream) |
| Modifier and Type | Method and Description |
|---|---|
<R> Multi<R> |
apply(Function<? super T,? extends R> mapper)
Deprecated.
|
<O> Multi<O> |
castTo(Class<O> target)
Produces an
Multi emitting the item events based on the upstream events but casted to the target class. |
<O> Multi<O> |
disjoint()
Takes the items from the upstream
Multi that are either Publisher<O>,
O[], Iterable<O> or Multi<O> and
disjoint the items to obtain a Multi<O>. |
Multi<Void> |
ignore()
Ignores the passed items.
|
Uni<Void> |
ignoreAsUni()
Ignores the passed items.
|
Multi<T> |
invoke(Consumer<? super T> callback)
Produces a new
Multi invoking the given callback when an item event is fired by the upstream. |
Multi<T> |
invokeUni(Function<? super T,? extends Uni<?>> action)
Produces a new
Multi invoking the given @{code action} when an item event is received. |
<O> MultiFlatten<T,O> |
produceCompletionStage(Function<? super T,? extends CompletionStage<? extends O>> mapper)
Deprecated.
Use
transformToUni(Function) and creates a new Uni from the CompletionStage |
<O> MultiFlatten<T,O> |
produceIterable(Function<? super T,? extends Iterable<? extends O>> mapper)
Deprecated.
Use
transformToIterable(Function) instead |
<O> MultiFlatten<T,O> |
produceMulti(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
Deprecated.
Use
transformToMulti(Function) instead |
<O> MultiFlatten<T,O> |
producePublisher(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
Deprecated.
Use
transformToMulti(Function) instead. |
<O> MultiFlatten<T,O> |
produceUni(Function<? super T,? extends Uni<? extends O>> mapper)
Deprecated.
Use
transformToUni(Function) instead |
Multi<T> |
scan(BinaryOperator<T> accumulator)
|
<S> Multi<S> |
scan(Supplier<S> initialStateProducer,
BiFunction<S,? super T,S> accumulator)
|
<R> Multi<R> |
transform(Function<? super T,? extends R> mapper)
|
<O> Multi<O> |
transformToIterable(Function<? super T,? extends Iterable<O>> mapper)
On each item received from the upstream, call the given mapper.
|
<O> MultiFlatten<T,O> |
transformToMulti(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
On each item received from upstream, invoke the given mapper.
|
<O> Multi<O> |
transformToMultiAndConcatenate(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
For each items emitted by the upstream, the given
mapper is invoked. |
<O> Multi<O> |
transformToMultiAndMerge(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
For each items emitted by the upstream, the given
mapper is invoked. |
<O> MultiFlatten<T,O> |
transformToUni(Function<? super T,? extends Uni<? extends O>> mapper)
On each item received from upstream, invoke the given mapper.
|
<O> Multi<O> |
transformToUniAndConcatenate(Function<? super T,? extends Uni<? extends O>> mapper)
For each items emitted by the upstream, the given
mapper is invoked. |
<O> Multi<O> |
transformToUniAndMerge(Function<? super T,? extends Uni<? extends O>> mapper)
For each items emitted by the upstream, the given
mapper is invoked. |
@Deprecated public <R> Multi<R> apply(Function<? super T,? extends R> mapper)
transform(Function)Multi invoking the given function for each item emitted by the upstream Multi.
The function receives the received item as parameter, and can transform it. The returned object is sent
downstream as item event.
R - the type of item produced by the mapper functionmapper - the mapper function, must not be nullMultipublic <R> Multi<R> transform(Function<? super T,? extends R> mapper)
Multi invoking the given function for each item emitted by the upstream Multi.
The function receives the received item as parameter, and can transform it. The returned object is sent
downstream as item event.
R - the type of item produced by the mapper functionmapper - the mapper function, must not be nullMultipublic Multi<T> invoke(Consumer<? super T> callback)
Multi invoking the given callback when an item event is fired by the upstream.
Note that the received item cannot be null.
If the callback throws an exception, this exception is propagated to the downstream as failure. No more items will be consumed.
callback - the callback, must not be nullMultipublic Multi<T> invokeUni(Function<? super T,? extends Uni<?>> action)
Multi invoking the given @{code action} when an item event is received. Note that
the received item cannot be null.
Unlike invoke(Consumer), the passed function returns a Uni. When the produced Uni sends
its result, the result is discarded, and the original item is forwarded downstream. If the produced
Uni fails, the failure is propagated downstream.
If the asynchronous action throws an exception, this exception is propagated downstream.
This method preserves the order of the items, meaning that the downstream received the items in the same order as the upstream has emitted them.
public <O> Multi<O> disjoint()
Multi that are either Publisher<O>,
O[], Iterable<O> or Multi<O> and
disjoint the items to obtain a Multi<O>.
For example, Multi<[A, B, C], [D, E, F] is transformed into Multi<A, B, C, D, E, F>.
If the items from upstream are not instances of Iterable, Publisher or array, an
IllegalArgumentException is propagated downstream.
O - the type items contained in the upstream's items.@Deprecated public <O> MultiFlatten<T,O> produceMulti(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
transformToMulti(Function) insteadPublisher or
a Multi. The return object lets you configure the flattening process, i.e. how the items produced
by the returned Publishers or Multis are propagated to the downstream.O - the type of item emitted by the Multi produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> MultiFlatten<T,O> transformToMulti(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
Publisher or
a Multi. The return object lets you configure the flattening process, i.e. how the items produced
by the returned Publishers or Multis are propagated to the downstream.O - the type of item emitted by the Multi produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> Multi<O> transformToMultiAndConcatenate(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
mapper is invoked. This mapper returns a
Publisher. The events emitted by the returned Publisher are propagated downstream using a
concatenation, meaning that it does not interleaved the items produced by the different
Publishers.
For example, let's imagine an upstream multi {a, b, c} and a mapper emitting the 3 items with some delays
between them. For example a -> {a1, a2, a3}, b -> {b1, b2, b3} and c -> {c1, c2, c3}. Using this method
on the multi {a, b c} with that mapper may produce the following multi {a1, a2, a3, b1, b2, b3, c1, c2, c3}.
So produced multis are concatenated.
This operation is often called concatMap.
If the mapper throws an exception, the failure is propagated downstream. No more items will be emitted.
If one of the produced Publisher propagates a failure, the failure is propagated downstream and no
more items will be emitted.O - the type of item emitted by the Multi produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> Multi<O> transformToMultiAndMerge(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
mapper is invoked. This mapper returns a
Publisher. The events emitted by the returned Publisher are propagated using a merge,
meaning that it may interleave events produced by the different Publishers.
For example, let's imagine an upstream multi {a, b, c} and a mapper emitting the 3 items with some delays
between them. For example a -> {a1, a2, a3}, b -> {b1, b2, b3} and c -> {c1, c2, c3}. Using this method
on the multi {a, b c} with that mapper may produce the following multi {a1, b1, a2, c1, b2, c2, a3, b3, c3}.
So the items from the produced multis are interleaved and are emitted as soon as they are emitted (respecting
the downstream request).
This operation is often called flatMap.
If the mapper throws an exception, the failure is propagated downstream. No more items will be emitted.
If one of the produced Publisher propagates a failure, the failure is propagated downstream and no
more items will be emitted.O - the type of item emitted by the Multi produced by the mapper.mapper - the mapper, must not be null, must not produce null@Deprecated public <O> MultiFlatten<T,O> producePublisher(Function<? super T,? extends org.reactivestreams.Publisher<? extends O>> mapper)
transformToMulti(Function) instead.Publisher or
a Multi. The return object lets you configure the flattening process, i.e. how the items produced
by the returned Publishers or Multis are propagated to the downstream.O - the type of item emitted by the Multi produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> Multi<O> transformToIterable(Function<? super T,? extends Iterable<O>> mapper)
Iterable.
The items from the returned Iterable are propagated downstream (one by one). As Iterable is
a synchronous construct, this method concatenates the items produced by the different returns iterables.O - the type of item contained by the Iterable produced by the mapper.mapper - the mapper, must not be null, must not produce null@Deprecated public <O> MultiFlatten<T,O> produceIterable(Function<? super T,? extends Iterable<? extends O>> mapper)
transformToIterable(Function) insteaditerable and is called for each item emitted by the upstream Multi.O - the type of item contained by the Iterable produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> MultiFlatten<T,O> transformToUni(Function<? super T,? extends Uni<? extends O>> mapper)
Uni<T>.
The return object lets you configure the flattening process, i.e. how the items produced
by the returned Unis are propagated to the downstream.O - the type of item emitted by the Multi produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> Multi<O> transformToUniAndConcatenate(Function<? super T,? extends Uni<? extends O>> mapper)
mapper is invoked. This mapper returns a
Uni. The events emitted by the returned Uni are emitted downstream. Items emitted
by the returned Unis are emitted downstream using a merge, meaning that it
may interleave events produced by the different Uni.
For example, let's imagine an upstream multi {a, b, c} and a mapper emitting 1 items. This emission may be
delayed for various reasons. For example a -> a1 without delay, b -> b1 after some delay and c -> c1 without
delay. Using this method on the multi {a, b c} with that mapper would produce the following multi {a1, c1, b1}.
Indeed, the b1 item is emitted after c1. So the items from the produced unis are interleaved and are emitted as
soon as they are emitted (respecting the downstream request).
This operation is often called flatMapSingle.
If the mapper throws an exception, the failure is propagated downstream. No more items will be emitted.
If one of the produced Uni propagates a failure, the failure is propagated downstream and no
more items will be emitted.O - the type of item emitted by the Multi produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic <O> Multi<O> transformToUniAndMerge(Function<? super T,? extends Uni<? extends O>> mapper)
mapper is invoked. This mapper returns a
Uni. The events emitted by the returned Uni are emitted downstream. Items emitted
by the returned Unis are emitted downstream using a concatenation, meaning the the returned
Multi contains the items in the same order as the upstream.
For example, let's imagine an upstream multi {a, b, c} and a mapper emitting 1 items. This emission may be
delayed for various reasons. For example a -> a1 without delay, b -> b1 after some delay and c -> c1 without
delay. Using this method on the multi {a, b c} with that mapper would produce the following multi {a1, b1, c1}.
Indeed, even if c1 could be emitted before b1, this method preserves the order. So the items from the produced
unis are concatenated.
This operation is often called concatMapSingle.
If the mapper throws an exception, the failure is propagated downstream. No more items will be emitted.
If one of the produced Uni propagates a failure, the failure is propagated downstream and no
more items will be emitted.O - the type of item emitted by the Multi produced by the mapper.mapper - the mapper, must not be null, must not produce null@Deprecated public <O> MultiFlatten<T,O> produceUni(Function<? super T,? extends Uni<? extends O>> mapper)
transformToUni(Function) insteadUni<T>.
The return object lets you configure the flattening process, i.e. how the items produced
by the returned Unis are propagated to the downstream.O - the type of item emitted by the Multi produced by the mapper.mapper - the mapper, must not be null, must not produce null@Deprecated public <O> MultiFlatten<T,O> produceCompletionStage(Function<? super T,? extends CompletionStage<? extends O>> mapper)
transformToUni(Function) and creates a new Uni from the CompletionStageCompletionStage and is called for each item emitted by the upstream Multi.O - the type of item emitted by the CompletionStage produced by the mapper.mapper - the mapper, must not be null, must not produce nullpublic Multi<Void> ignore()
Multi will only be notified when the stream completes or fails.public Uni<Void> ignoreAsUni()
Uni will only be completed with null when the stream
completes or with a failure if the upstream emits a failure..public <O> Multi<O> castTo(Class<O> target)
Multi emitting the item events based on the upstream events but casted to the target class.O - the type of item emitted by the produced unitarget - the target classpublic <S> Multi<S> scan(Supplier<S> initialStateProducer, BiFunction<S,? super T,S> accumulator)
Multi that fires items coming from the reduction of the item emitted by this current
Multi by the passed accumulator reduction function. The produced multi emits the intermediate
results.
Unlike scan(BinaryOperator), this operator uses the value produced by the initialStateProducer as
first value.
S - the type of item emitted by the produced Multi. It's the type returned by the
accumulator operation.initialStateProducer - the producer called to provides the initial value passed to the accumulator operation.accumulator - the reduction BiFunction, the resulting Multi emits the results of
this method. The method is called for every item emitted by this Multi.Multipublic Multi<T> scan(BinaryOperator<T> accumulator)
Multi that fires results coming from the reduction of the item emitted by this current
Multi by the passed accumulator reduction function. The produced multi emits the intermediate
results.
Unlike scan(Supplier, BiFunction), this operator doesn't take an initial value but takes the first
item emitted by this Multi as initial value.
accumulator - the reduction BiFunction, the resulting Multi emits the results of this method.
The method is called for every item emitted by this Multi.MultiCopyright © 2019–2020 SmallRye. All rights reserved.