T
- the element type of this Reactive Streams Publisher
public abstract class Flux<T>
extends java.lang.Object
implements org.reactivestreams.Publisher<T>
Publisher
with rx operators that emits 0 to N elements, and then completes
(successfully or with an error).
It is intended to be used in implementations and return types. Input parameters should keep using raw
Publisher
as much as possible.
If it is known that the underlying Publisher
will emit 0 or 1 element, Mono
should be used
instead.
Mono
Constructor and Description |
---|
Flux() |
Modifier and Type | Method and Description |
---|---|
Mono<java.lang.Boolean> |
all(java.util.function.Predicate<? super T> predicate)
Emit a single boolean true if all values of this sequence match
the
Predicate . |
Mono<java.lang.Boolean> |
any(java.util.function.Predicate<? super T> predicate)
Emit a single boolean true if any of the values of this
Flux sequence match
the predicate. |
<P> P |
as(java.util.function.Function<? super Flux<T>,P> transformer)
Immediately apply the given transformation to this
Flux in order to generate a target type. |
Flux<T> |
awaitOnSubscribe()
Intercepts the onSubscribe call and makes sure calls to Subscription methods
only happen after the child Subscriber has returned from its onSubscribe method.
|
T |
blockFirst()
Blocks until the upstream signals its first value or completes.
|
T |
blockFirst(java.time.Duration d)
Blocks until the upstream signals its first value or completes.
|
T |
blockFirstMillis(long timeout)
Blocks until the upstream signals its first value or completes.
|
T |
blockLast()
Blocks until the upstream completes and return the last emitted value.
|
T |
blockLast(java.time.Duration d)
Blocks until the upstream completes and return the last emitted value.
|
T |
blockLastMillis(long timeout)
Blocks until the upstream completes and return the last emitted value.
|
Flux<java.util.List<T>> |
buffer()
Collect incoming values into a
List that will be pushed into the returned Flux on complete only. |
Flux<java.util.List<T>> |
buffer(java.time.Duration timespan)
Collect incoming values into multiple
List that will be pushed into the returned Flux every
timespan. |
Flux<java.util.List<T>> |
buffer(java.time.Duration timespan,
java.time.Duration timeshift)
Collect incoming values into multiple
List delimited by the given timeshift period. |
Flux<java.util.List<T>> |
buffer(int maxSize)
Collect incoming values into multiple
List buckets that will be pushed into the returned Flux
when the given max size is reached or onComplete is received. |
Flux<java.util.List<T>> |
buffer(int maxSize,
java.time.Duration timespan)
Collect incoming values into a
List that will be pushed into the returned Flux every timespan OR
maxSize items. |
<C extends java.util.Collection<? super T>> |
buffer(int maxSize,
java.time.Duration timespan,
java.util.function.Supplier<C> bufferSupplier)
Collect incoming values into a
Collection that will be pushed into the returned Flux every timespan OR
maxSize items. |
Flux<java.util.List<T>> |
buffer(int maxSize,
int skip)
Collect incoming values into multiple
List that will be pushed into the returned Flux when the
given max size is reached or onComplete is received. |
<C extends java.util.Collection<? super T>> |
buffer(int maxSize,
int skip,
java.util.function.Supplier<C> bufferSupplier)
Collect incoming values into multiple
Collection that will be pushed into
the returned Flux when the
given max size is reached or onComplete is received. |
<C extends java.util.Collection<? super T>> |
buffer(int maxSize,
java.util.function.Supplier<C> bufferSupplier)
Collect incoming values into multiple
Collection buckets that will be
pushed into the returned Flux
when the given max size is reached or onComplete is received. |
Flux<java.util.List<T>> |
buffer(org.reactivestreams.Publisher<?> other)
Collect incoming values into multiple
List delimited by the given Publisher signals. |
<C extends java.util.Collection<? super T>> |
buffer(org.reactivestreams.Publisher<?> other,
java.util.function.Supplier<C> bufferSupplier)
Collect incoming values into multiple
Collection delimited by the given Publisher signals. |
<U,V> Flux<java.util.List<T>> |
buffer(org.reactivestreams.Publisher<U> bucketOpening,
java.util.function.Function<? super U,? extends org.reactivestreams.Publisher<V>> closeSelector)
Collect incoming values into multiple
List delimited by the given Publisher signals. |
<U,V,C extends java.util.Collection<? super T>> |
buffer(org.reactivestreams.Publisher<U> bucketOpening,
java.util.function.Function<? super U,? extends org.reactivestreams.Publisher<V>> closeSelector,
java.util.function.Supplier<C> bufferSupplier)
Collect incoming values into multiple
Collection delimited by the given Publisher signals. |
Flux<java.util.List<T>> |
bufferMillis(int maxSize,
long timespan)
Collect incoming values into a
List that will be pushed into the returned Flux every timespan OR
maxSize items. |
Flux<java.util.List<T>> |
bufferMillis(int maxSize,
long timespan,
TimedScheduler timer)
Collect incoming values into a
List that will be pushed into the returned Flux every timespan OR
maxSize items |
<C extends java.util.Collection<? super T>> |
bufferMillis(int maxSize,
long timespan,
TimedScheduler timer,
java.util.function.Supplier<C> bufferSupplier)
Collect incoming values into a
Collection that will be pushed into the returned Flux every timespan OR
maxSize items |
Flux<java.util.List<T>> |
bufferMillis(long timespan)
Collect incoming values into multiple
List that will be pushed into the returned Flux every
timespan. |
Flux<java.util.List<T>> |
bufferMillis(long timespan,
long timeshift)
Collect incoming values into multiple
List delimited by the given timeshift period. |
Flux<java.util.List<T>> |
bufferMillis(long timespan,
long timeshift,
TimedScheduler timer)
Collect incoming values into multiple
List delimited by the given timeshift period. |
Flux<java.util.List<T>> |
bufferMillis(long timespan,
TimedScheduler timer)
Collect incoming values into multiple
List that will be pushed into the returned Flux every
timespan. |
Flux<T> |
cache()
Turn this
Flux into a hot source and cache last emitted signals for further Subscriber . |
Flux<T> |
cache(java.time.Duration ttl)
Turn this
Flux into a hot source and cache last emitted signals for further
Subscriber . |
Flux<T> |
cache(int history)
Turn this
Flux into a hot source and cache last emitted signals for further Subscriber . |
Flux<T> |
cache(int history,
java.time.Duration ttl)
Turn this
Flux into a hot source and cache last emitted signals for further
Subscriber . |
Flux<T> |
cancelOn(Scheduler scheduler)
|
<E> Flux<E> |
cast(java.lang.Class<E> clazz)
Cast the current
Flux produced type into a target produced type. |
<R,A> Mono<R> |
collect(java.util.stream.Collector<T,A,R> collector)
Collect the
Flux sequence with the given collector and supplied container on subscribe. |
<E> Mono<E> |
collect(java.util.function.Supplier<E> containerSupplier,
java.util.function.BiConsumer<E,? super T> collector)
Collect the
Flux sequence with the given collector and supplied container on subscribe. |
Mono<java.util.List<T>> |
collectList()
|
<K> Mono<java.util.Map<K,T>> |
collectMap(java.util.function.Function<? super T,? extends K> keyExtractor)
Convert all this
Flux sequence into a hashed map where the key is extracted by the given Function and the
value will be the most recent emitted item for this key. |
<K,V> Mono<java.util.Map<K,V>> |
collectMap(java.util.function.Function<? super T,? extends K> keyExtractor,
java.util.function.Function<? super T,? extends V> valueExtractor)
Convert all this
Flux sequence into a hashed map where the key is extracted by the given function and the value will be
the most recent extracted item for this key. |
<K,V> Mono<java.util.Map<K,V>> |
collectMap(java.util.function.Function<? super T,? extends K> keyExtractor,
java.util.function.Function<? super T,? extends V> valueExtractor,
java.util.function.Supplier<java.util.Map<K,V>> mapSupplier)
Convert all this
Flux sequence into a supplied map where the key is extracted by the given function and the value will
be the most recent extracted item for this key. |
<K> Mono<java.util.Map<K,java.util.Collection<T>>> |
collectMultimap(java.util.function.Function<? super T,? extends K> keyExtractor)
Convert this
Flux sequence into a hashed map where the key is extracted by the given function and the value will be
all the emitted item for this key. |
<K,V> Mono<java.util.Map<K,java.util.Collection<V>>> |
collectMultimap(java.util.function.Function<? super T,? extends K> keyExtractor,
java.util.function.Function<? super T,? extends V> valueExtractor)
Convert this
Flux sequence into a hashed map where the key is extracted by the given function and the value will be
all the extracted items for this key. |
<K,V> Mono<java.util.Map<K,java.util.Collection<V>>> |
collectMultimap(java.util.function.Function<? super T,? extends K> keyExtractor,
java.util.function.Function<? super T,? extends V> valueExtractor,
java.util.function.Supplier<java.util.Map<K,java.util.Collection<V>>> mapSupplier)
Convert this
Flux sequence into a supplied map where the key is extracted by the given function and the value will
be all the extracted items for this key. |
Mono<java.util.List<T>> |
collectSortedList()
|
Mono<java.util.List<T>> |
collectSortedList(java.util.Comparator<? super T> comparator)
|
static <T,V> Flux<V> |
combineLatest(java.util.function.Function<java.lang.Object[],V> combinator,
int prefetch,
org.reactivestreams.Publisher<? extends T>... sources)
Build a
Flux whose data are generated by the combination of the most recent published values from all
publishers. |
static <T,V> Flux<V> |
combineLatest(java.util.function.Function<java.lang.Object[],V> combinator,
org.reactivestreams.Publisher<? extends T>... sources)
Build a
Flux whose data are generated by the combination of the most recent published values from all
publishers. |
static <T,V> Flux<V> |
combineLatest(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends T>> sources,
java.util.function.Function<java.lang.Object[],V> combinator)
Build a
Flux whose data are generated by the combination of the most recent published values from all
publishers. |
static <T,V> Flux<V> |
combineLatest(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends T>> sources,
int prefetch,
java.util.function.Function<java.lang.Object[],V> combinator)
Build a
Flux whose data are generated by the combination of the most recent published values from all
publishers. |
static <T1,T2,V> Flux<V> |
combineLatest(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2,
java.util.function.BiFunction<? super T1,? super T2,? extends V> combinator)
Build a
Flux whose data are generated by the combination of the most recent published values from all
publishers. |
static <T1,T2,T3,V> |
combineLatest(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2,
org.reactivestreams.Publisher<? extends T3> source3,
java.util.function.Function<java.lang.Object[],V> combinator)
Build a
Flux whose data are generated by the combination of the most recent published values from all
publishers. |
static <T1,T2,T3,T4,V> |
combineLatest(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2,
org.reactivestreams.Publisher<? extends T3> source3,
org.reactivestreams.Publisher<? extends T4> source4,
java.util.function.Function<java.lang.Object[],V> combinator)
Build a
Flux whose data are generated by the combination of the most recent published values from all
publishers. |
static <T1,T2,T3,T4,T5,V> |
combineLatest(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2,
org.reactivestreams.Publisher<? extends T3> source3,
org.reactivestreams.Publisher<? extends T4> source4,
org.reactivestreams.Publisher<? extends T5> source5,
java.util.function.Function<java.lang.Object[],V> combinator)
Build a
Flux whose data are generated by the combination of the most recent published values from all
publishers. |
static <T1,T2,T3,T4,T5,T6,V> |
combineLatest(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2,
org.reactivestreams.Publisher<? extends T3> source3,
org.reactivestreams.Publisher<? extends T4> source4,
org.reactivestreams.Publisher<? extends T5> source5,
org.reactivestreams.Publisher<? extends T6> source6,
java.util.function.Function<java.lang.Object[],V> combinator)
Build a
Flux whose data are generated by the combination of the most recent published values from all
publishers. |
<V> Flux<V> |
compose(java.util.function.Function<? super Flux<T>,? extends org.reactivestreams.Publisher<V>> transformer)
|
static <T> Flux<T> |
concat(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends T>> sources)
Concat all sources pulled from the supplied
Iterator on Publisher.subscribe(org.reactivestreams.Subscriber<? super T>) from the passed Iterable until Iterator.hasNext()
returns false. |
static <T> Flux<T> |
concat(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources)
Concat all sources emitted as an onNext signal from a parent
Publisher . |
static <T> Flux<T> |
concat(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources,
int prefetch)
Concat all sources emitted as an onNext signal from a parent
Publisher . |
static <T> Flux<T> |
concat(org.reactivestreams.Publisher<? extends T>... sources)
Concat all sources pulled from the given
Publisher array. |
static <T> Flux<T> |
concatDelayError(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources)
Concat all sources emitted as an onNext signal from a parent
Publisher . |
static <T> Flux<T> |
concatDelayError(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources,
boolean delayUntilEnd,
int prefetch)
Concat all sources emitted as an onNext signal from a parent
Publisher . |
static <T> Flux<T> |
concatDelayError(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources,
int prefetch)
Concat all sources emitted as an onNext signal from a parent
Publisher . |
static <T> Flux<T> |
concatDelayError(org.reactivestreams.Publisher<? extends T>... sources)
Concat all sources pulled from the given
Publisher array. |
<V> Flux<V> |
concatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper)
Bind dynamic sequences given this input sequence like
flatMap(Function) , but preserve
ordering and concatenate emissions instead of merging (no interleave). |
<V> Flux<V> |
concatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper,
int prefetch)
Bind dynamic sequences given this input sequence like
flatMap(Function) , but preserve
ordering and concatenate emissions instead of merging (no interleave). |
<V> Flux<V> |
concatMapDelayError(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper,
boolean delayUntilEnd,
int prefetch)
Bind dynamic sequences given this input sequence like
flatMap(Function) , but preserve
ordering and concatenate emissions instead of merging (no interleave). |
<V> Flux<V> |
concatMapDelayError(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper,
int prefetch)
Bind dynamic sequences given this input sequence like
flatMap(Function) , but preserve
ordering and concatenate emissions instead of merging (no interleave). |
<V> Flux<V> |
concatMapDelayError(java.util.function.Function<? super T,org.reactivestreams.Publisher<? extends V>> mapper)
Bind dynamic sequences given this input sequence like
flatMap(Function) , but preserve
ordering and concatenate emissions instead of merging (no interleave). |
<R> Flux<R> |
concatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
Bind
Iterable sequences given this input sequence like flatMapIterable(Function) , but preserve
ordering and concatenate emissions instead of merging (no interleave). |
<R> Flux<R> |
concatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper,
int prefetch)
Bind
Iterable sequences given this input sequence like flatMapIterable(Function) , but preserve
ordering and concatenate emissions instead of merging (no interleave). |
Flux<T> |
concatWith(org.reactivestreams.Publisher<? extends T> other)
Concatenate emissions of this
Flux with the provided Publisher (no interleave). |
Mono<java.lang.Long> |
count()
Counts the number of values in this
Flux . |
static <T> Flux<T> |
create(java.util.function.Consumer<? super FluxSink<T>> emitter)
Creates a Flux with multi-emission capabilities (synchronous or asynchronous) through
the FluxSink API.
|
static <T> Flux<T> |
create(java.util.function.Consumer<? super FluxSink<T>> emitter,
FluxSink.OverflowStrategy backpressure)
Creates a Flux with multi-emission capabilities (synchronous or asynchronous) through
the FluxSink API.
|
Flux<T> |
defaultIfEmpty(T defaultV)
Provide a default unique value if this sequence is completed without any data
|
static <T> Flux<T> |
defer(java.util.function.Supplier<? extends org.reactivestreams.Publisher<T>> supplier)
Supply a
Publisher everytime subscribe is called on the returned flux. |
Flux<T> |
delay(java.time.Duration delay)
Delay this
Flux signals to Subscriber.onNext(T) until the given period elapses. |
Flux<T> |
delayMillis(long delay)
Delay this
Flux signals to Subscriber.onNext(T) until the given period in milliseconds elapses. |
Flux<T> |
delayMillis(long delay,
TimedScheduler timer)
Delay this
Flux signals to Subscriber.onNext(T) until the given period in milliseconds elapses. |
Flux<T> |
delaySubscription(java.time.Duration delay)
Delay the
subscription to this Flux source until the given
period elapses. |
<U> Flux<T> |
delaySubscription(org.reactivestreams.Publisher<U> subscriptionDelay)
Delay the subscription to the main source until another Publisher
signals a value or completes.
|
Flux<T> |
delaySubscriptionMillis(long delay)
Delay the
subscription to this Flux source until the given
period elapses. |
Flux<T> |
delaySubscriptionMillis(long delay,
TimedScheduler timer)
Delay the
subscription to this Flux source until the given
period elapses. |
<X> Flux<X> |
dematerialize()
|
Flux<T> |
distinct()
For each
Subscriber , tracks this Flux values that have been seen and
filters out duplicates. |
<V> Flux<T> |
distinct(java.util.function.Function<? super T,? extends V> keySelector)
For each
Subscriber , tracks this Flux values that have been seen and
filters out duplicates given the extracted key. |
Flux<T> |
distinctUntilChanged()
Filters out subsequent and repeated elements.
|
<V> Flux<T> |
distinctUntilChanged(java.util.function.Function<? super T,? extends V> keySelector)
Filters out subsequent and repeated elements provided a matching extracted key.
|
Flux<T> |
doAfterTerminate(java.lang.Runnable afterTerminate)
Triggered after the
Flux terminates, either by completing downstream successfully or with an error. |
Flux<T> |
doOnCancel(java.lang.Runnable onCancel)
Triggered when the
Flux is cancelled. |
Flux<T> |
doOnComplete(java.lang.Runnable onComplete)
Triggered when the
Flux completes successfully. |
<E extends java.lang.Throwable> |
doOnError(java.lang.Class<E> exceptionType,
java.util.function.Consumer<? super E> onError)
Triggered when the
Flux completes with an error matching the given exception type. |
Flux<T> |
doOnError(java.util.function.Consumer<? super java.lang.Throwable> onError)
Triggered when the
Flux completes with an error. |
Flux<T> |
doOnError(java.util.function.Predicate<? super java.lang.Throwable> predicate,
java.util.function.Consumer<? super java.lang.Throwable> onError)
Triggered when the
Flux completes with an error matching the given exception. |
Flux<T> |
doOnNext(java.util.function.Consumer<? super T> onNext)
Triggered when the
Flux emits an item. |
Flux<T> |
doOnRequest(java.util.function.LongConsumer consumer)
|
Flux<T> |
doOnSubscribe(java.util.function.Consumer<? super org.reactivestreams.Subscription> onSubscribe)
Triggered when the
Flux is subscribed. |
Flux<T> |
doOnTerminate(java.lang.Runnable onTerminate)
Triggered when the
Flux terminates, either by completing successfully or with an error. |
Flux<Tuple2<java.lang.Long,T>> |
elapsed()
|
Flux<Tuple2<java.lang.Long,T>> |
elapsed(TimedScheduler scheduler)
|
Mono<T> |
elementAt(int index)
Emit only the element at the given index position or
IndexOutOfBoundsException if the sequence is shorter. |
Mono<T> |
elementAt(int index,
T defaultValue)
Emit only the element at the given index position or signals a
default value if specified if the sequence is shorter.
|
static <T> Flux<T> |
empty()
Create a
Flux that completes without emitting any item. |
static <T> Flux<T> |
error(java.lang.Throwable error)
Create a
Flux that completes with the specified error. |
static <O> Flux<O> |
error(java.lang.Throwable throwable,
boolean whenRequested)
Build a
Flux that will only emit an error signal to any new subscriber. |
Flux<T> |
filter(java.util.function.Predicate<? super T> p)
Evaluate each accepted value against the given
Predicate . |
static <I> Flux<I> |
firstEmitting(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends I>> sources)
Select the fastest source who won the "ambiguous" race and emitted first onNext or onComplete or onError
|
static <I> Flux<I> |
firstEmitting(org.reactivestreams.Publisher<? extends I>... sources)
Select the fastest source who emitted first onNext or onComplete or onError
|
Flux<T> |
firstEmittingWith(org.reactivestreams.Publisher<? extends T> other)
Emit from the fastest first sequence between this publisher and the given publisher
|
<R> Flux<R> |
flatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
|
<R> Flux<R> |
flatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapperOnNext,
java.util.function.Function<java.lang.Throwable,? extends org.reactivestreams.Publisher<? extends R>> mapperOnError,
java.util.function.Supplier<? extends org.reactivestreams.Publisher<? extends R>> mapperOnComplete)
|
<V> Flux<V> |
flatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper,
boolean delayError,
int concurrency,
int prefetch)
|
<V> Flux<V> |
flatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper,
int concurrency)
|
<V> Flux<V> |
flatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper,
int concurrency,
int prefetch)
|
<R> Flux<R> |
flatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
|
<R> Flux<R> |
flatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper,
int prefetch)
|
<R> Flux<R> |
flatMapSequential(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
|
<R> Flux<R> |
flatMapSequential(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper,
boolean delayError,
int maxConcurrency,
int prefetch)
|
<R> Flux<R> |
flatMapSequential(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper,
int maxConcurrency)
|
<R> Flux<R> |
flatMapSequential(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper,
int maxConcurrency,
int prefetch)
|
static <T> Flux<T> |
from(org.reactivestreams.Publisher<? extends T> source)
Expose the specified
Publisher with the Flux API. |
static <T> Flux<T> |
fromArray(T[] array)
Create a
Flux that emits the items contained in the provided Iterable . |
static <T> Flux<T> |
fromIterable(java.lang.Iterable<? extends T> it)
Create a
Flux that emits the items contained in the provided Iterable . |
static <T> Flux<T> |
fromStream(java.util.stream.Stream<? extends T> s)
Create a
Flux that emits the items contained in the provided Stream . |
static <T,S> Flux<T> |
generate(java.util.concurrent.Callable<S> stateSupplier,
java.util.function.BiFunction<S,SynchronousSink<T>,S> generator)
Generate signals one-by-one via a function callback.
|
static <T,S> Flux<T> |
generate(java.util.concurrent.Callable<S> stateSupplier,
java.util.function.BiFunction<S,SynchronousSink<T>,S> generator,
java.util.function.Consumer<? super S> stateConsumer)
Generate signals one-by-one via a function callback.
|
static <T> Flux<T> |
generate(java.util.function.Consumer<SynchronousSink<T>> generator)
Generate signals one-by-one via a consumer callback.
|
long |
getPrefetch()
The prefetch configuration of the
Flux |
<K> Flux<GroupedFlux<K,T>> |
groupBy(java.util.function.Function<? super T,? extends K> keyMapper)
Re-route this sequence into dynamically created
Flux for each unique key evaluated by the given
key mapper. |
<K,V> Flux<GroupedFlux<K,V>> |
groupBy(java.util.function.Function<? super T,? extends K> keyMapper,
java.util.function.Function<? super T,? extends V> valueMapper)
Re-route this sequence into dynamically created
Flux for each unique key evaluated by the given
key mapper. |
<TRight,TLeftEnd,TRightEnd,R> |
groupJoin(org.reactivestreams.Publisher<? extends TRight> other,
java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<TLeftEnd>> leftEnd,
java.util.function.Function<? super TRight,? extends org.reactivestreams.Publisher<TRightEnd>> rightEnd,
java.util.function.BiFunction<? super T,? super Flux<TRight>,? extends R> resultSelector)
Returns a
Flux that correlates two Publishers when they overlap in time
and groups the results. |
<R> Flux<R> |
handle(java.util.function.BiConsumer<? super T,SynchronousSink<R>> handler)
Handle the items emitted by this
Flux by calling a biconsumer with the
output sink for each onNext. |
Mono<java.lang.Boolean> |
hasElement(T value)
Emit a single boolean true if any of the values of this
Flux sequence match
the constant. |
Mono<java.lang.Boolean> |
hasElements()
Emit a single boolean true if this
Flux sequence has at least one element. |
Flux<T> |
hide()
Hides the identities of this
Flux and its Subscription
as well. |
Mono<T> |
ignoreElements()
Ignores onNext signals (dropping them) and only reacts on termination.
|
static Flux<java.lang.Long> |
interval(java.time.Duration period)
Create a new
Flux that emits an ever incrementing long starting with 0 every period on
the global timer. |
static Flux<java.lang.Long> |
interval(java.time.Duration delay,
java.time.Duration period)
Create a new
Flux that emits an ever incrementing long starting with 0 every N period of time unit on
a global timer. |
static Flux<java.lang.Long> |
intervalMillis(long period)
Create a new
Flux that emits an ever incrementing long starting with 0 every N milliseconds on
the given timer. |
static Flux<java.lang.Long> |
intervalMillis(long delay,
long period)
Create a new
Flux that emits an ever incrementing long starting with 0 every N period of time unit on
a global timer. |
static Flux<java.lang.Long> |
intervalMillis(long delay,
long period,
TimedScheduler timer)
Create a new
Flux that emits an ever incrementing long starting with 0 every N period of time unit on
the given timer. |
static Flux<java.lang.Long> |
intervalMillis(long period,
TimedScheduler timer)
Create a new
Flux that emits an ever incrementing long starting with 0 every N milliseconds on
the given timer. |
<TRight,TLeftEnd,TRightEnd,R> |
join(org.reactivestreams.Publisher<? extends TRight> other,
java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<TLeftEnd>> leftEnd,
java.util.function.Function<? super TRight,? extends org.reactivestreams.Publisher<TRightEnd>> rightEnd,
java.util.function.BiFunction<? super T,? super TRight,? extends R> resultSelector)
Returns a
Flux that correlates two Publishers when they overlap in time
and groups the results. |
static <T> Flux<T> |
just(T... data)
Create a new
Flux that emits the specified items and then complete. |
static <T> Flux<T> |
just(T data)
Create a new
Flux that will only emit the passed data then onComplete. |
Mono<T> |
last()
Signal the last element observed before complete signal or emit
NoSuchElementException error if the source was empty. |
Mono<T> |
last(T defaultValue)
Signal the last element observed before complete signal or emit
the defaultValue if empty.
|
Flux<T> |
limitRate(int prefetchRate)
Ensure that backpressure signals from downstream subscribers are capped at the
provided
prefetchRate when propagated upstream, effectively rate limiting
the upstream Publisher . |
Flux<T> |
log()
Observe all Reactive Streams signals and use
Logger support to handle trace implementation. |
Flux<T> |
log(java.lang.String category)
Observe all Reactive Streams signals and use
Logger support to handle trace implementation. |
Flux<T> |
log(java.lang.String category,
java.util.logging.Level level,
boolean showOperatorLine,
SignalType... options)
Observe Reactive Streams signals matching the passed filter
options and use
Logger support to handle trace implementation. |
Flux<T> |
log(java.lang.String category,
java.util.logging.Level level,
SignalType... options)
Observe Reactive Streams signals matching the passed filter
options and
use Logger support to
handle trace
implementation. |
<V> Flux<V> |
map(java.util.function.Function<? super T,? extends V> mapper)
Transform the items emitted by this
Flux by applying a function to each item. |
<E extends java.lang.Throwable> |
mapError(java.lang.Class<E> type,
java.util.function.Function<? super E,? extends java.lang.Throwable> mapper)
Transform the error emitted by this
Flux by applying a function if the
error matches the given type, otherwise let the error flows. |
Flux<T> |
mapError(java.util.function.Function<? super java.lang.Throwable,? extends java.lang.Throwable> mapper)
Transform the error emitted by this
Flux by applying a function. |
Flux<T> |
mapError(java.util.function.Predicate<? super java.lang.Throwable> predicate,
java.util.function.Function<? super java.lang.Throwable,? extends java.lang.Throwable> mapper)
Transform the error emitted by this
Flux by applying a function if the
error matches the given predicate, otherwise let the error flows. |
Flux<Signal<T>> |
materialize()
Transform the incoming onNext, onError and onComplete signals into
Signal . |
static <I> Flux<I> |
merge(int prefetch,
boolean delayError,
org.reactivestreams.Publisher<? extends I>... sources)
Merge emitted
Publisher sequences from the passed Publisher array into an interleaved merged
sequence. |
static <I> Flux<I> |
merge(int prefetch,
org.reactivestreams.Publisher<? extends I>... sources)
Merge emitted
Publisher sequences from the passed Publisher array into an interleaved merged
sequence. |
static <I> Flux<I> |
merge(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends I>> sources)
Merge emitted
Publisher sequences from the passed Iterable into an interleaved merged sequence. |
static <I> Flux<I> |
merge(org.reactivestreams.Publisher<? extends I>... sources)
Merge emitted
Publisher sequences from the passed Publisher array into an interleaved merged
sequence. |
static <T> Flux<T> |
merge(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> source)
Merge emitted
Publisher sequences by the passed Publisher into an interleaved merged sequence. |
static <T> Flux<T> |
merge(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> source,
int concurrency)
Merge emitted
Publisher sequences by the passed Publisher into an interleaved merged sequence. |
static <T> Flux<T> |
merge(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> source,
int concurrency,
int prefetch)
Merge emitted
Publisher sequences by the passed Publisher into an interleaved merged sequence. |
static <I> Flux<I> |
mergeSequential(int prefetch,
boolean delayError,
org.reactivestreams.Publisher<? extends I>... sources)
Merge a number of
Publisher sequences into an ordered merged sequence. |
static <I> Flux<I> |
mergeSequential(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends I>> sources)
Merge
Publisher sequences from an Iterable into an ordered merged
sequence. |
static <I> Flux<I> |
mergeSequential(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends I>> sources,
boolean delayError,
int maxConcurrency,
int prefetch)
Merge
Publisher sequences from an Iterable into an ordered merged
sequence. |
static <I> Flux<I> |
mergeSequential(org.reactivestreams.Publisher<? extends I>... sources)
Merge a number of
Publisher sequences into an ordered merged sequence. |
static <T> Flux<T> |
mergeSequential(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources)
Merge emitted
Publisher sequences by the passed Publisher into
an ordered merged sequence. |
static <T> Flux<T> |
mergeSequential(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources,
boolean delayError,
int maxConcurrency,
int prefetch)
Merge emitted
Publisher sequences by the passed Publisher into
an ordered merged sequence. |
Flux<T> |
mergeWith(org.reactivestreams.Publisher<? extends T> other)
Merge emissions of this
Flux with the provided Publisher , so that they may interleave. |
static <T> Flux<T> |
never()
Create a
Flux that will never signal any data, error or completion signal. |
Mono<T> |
next()
Emit only the first item emitted by this
Flux . |
<U> Flux<U> |
ofType(java.lang.Class<U> clazz)
Evaluate each accepted value against the given
Class type. |
protected static <T> ConnectableFlux<T> |
onAssembly(ConnectableFlux<T> source)
|
protected static <T> Flux<T> |
onAssembly(Flux<T> source)
|
Flux<T> |
onBackpressureBuffer()
Request an unbounded demand and push the returned
Flux , or park the observed elements if not enough
demand is requested downstream. |
Flux<T> |
onBackpressureBuffer(int maxSize)
Request an unbounded demand and push the returned
Flux , or park the observed elements if not enough
demand is requested downstream. |
Flux<T> |
onBackpressureBuffer(int maxSize,
java.util.function.Consumer<? super T> onOverflow)
Request an unbounded demand and push the returned
Flux , or park the observed elements if not enough
demand is requested downstream. |
Flux<T> |
onBackpressureDrop()
Request an unbounded demand and push the returned
Flux , or drop the observed elements if not enough
demand is requested downstream. |
Flux<T> |
onBackpressureDrop(java.util.function.Consumer<? super T> onDropped)
Request an unbounded demand and push the returned
Flux , or drop and notify dropping Consumer
with the observed elements if not enough demand is requested downstream. |
Flux<T> |
onBackpressureError()
Request an unbounded demand and push the returned
Flux , or emit onError fom Exceptions.failWithOverflow() if not enough demand is requested
downstream. |
Flux<T> |
onBackpressureLatest()
Request an unbounded demand and push the returned
Flux , or only keep the most recent observed item
if not enough demand is requested downstream. |
<E extends java.lang.Throwable> |
onErrorResumeWith(java.lang.Class<E> type,
java.util.function.Function<? super E,? extends org.reactivestreams.Publisher<? extends T>> fallback)
Subscribe to a returned fallback publisher when an error matching the given type
occurs.
|
Flux<T> |
onErrorResumeWith(java.util.function.Function<? super java.lang.Throwable,? extends org.reactivestreams.Publisher<? extends T>> fallback)
Subscribe to a returned fallback publisher when any error occurs.
|
Flux<T> |
onErrorResumeWith(java.util.function.Predicate<? super java.lang.Throwable> predicate,
java.util.function.Function<? super java.lang.Throwable,? extends org.reactivestreams.Publisher<? extends T>> fallback)
Subscribe to a returned fallback publisher when an error matching the given type
occurs.
|
<E extends java.lang.Throwable> |
onErrorReturn(java.lang.Class<E> type,
T fallbackValue)
Fallback to the given value if an error of a given type is observed on this
Flux |
<E extends java.lang.Throwable> |
onErrorReturn(java.util.function.Predicate<? super java.lang.Throwable> predicate,
T fallbackValue)
Fallback to the given value if an error matching the given predicate is
observed on this
Flux |
Flux<T> |
onErrorReturn(T fallbackValue)
Fallback to the given value if an error is observed on this
Flux |
Flux<T> |
onTerminateDetach()
Detaches the both the child
Subscriber and the Subscription on
termination or cancellation. |
ParallelFlux<T> |
parallel()
Prepare to consume this
Flux on number of 'rails' matching number of CPU
in round-robin fashion. |
ParallelFlux<T> |
parallel(int parallelism)
Prepare to consume this
Flux on parallallism number of 'rails'
in round-robin fashion. |
ParallelFlux<T> |
parallel(int parallelism,
int prefetch)
|
ConnectableFlux<T> |
publish()
Prepare a
ConnectableFlux which shares this Flux sequence and dispatches values to
subscribers in a backpressure-aware manner. |
<R> Flux<R> |
publish(java.util.function.Function<? super Flux<T>,? extends org.reactivestreams.Publisher<? extends R>> transform)
Shares a sequence 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> Flux<R> |
publish(java.util.function.Function<? super Flux<T>,? extends org.reactivestreams.Publisher<? extends R>> transform,
int prefetch)
Shares a sequence 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.
|
ConnectableFlux<T> |
publish(int prefetch)
Prepare a
ConnectableFlux which shares this Flux sequence and dispatches values to
subscribers in a backpressure-aware manner. |
Mono<T> |
publishNext()
|
Flux<T> |
publishOn(Scheduler scheduler)
Run onNext, onComplete and onError on a supplied
Scheduler
Scheduler.Worker . |
Flux<T> |
publishOn(Scheduler scheduler,
int prefetch)
Run onNext, onComplete and onError on a supplied
Scheduler
Scheduler.Worker . |
static Flux<java.lang.Integer> |
range(int start,
int count)
Build a
Flux that will only emit a sequence of incrementing integer from start to start + count then complete. |
<A> Mono<A> |
reduce(A initial,
java.util.function.BiFunction<A,? super T,A> accumulator)
Accumulate the values from this
Flux sequence into an object matching an initial value type. |
Mono<T> |
reduce(java.util.function.BiFunction<T,T,T> aggregator)
Aggregate the values from this
Flux sequence into an object of the same type than the
emitted items. |
<A> Mono<A> |
reduceWith(java.util.function.Supplier<A> initial,
java.util.function.BiFunction<A,? super T,A> accumulator)
Accumulate the values from this
Flux sequence into an object matching an initial value type. |
Flux<T> |
repeat()
Repeatedly subscribe to the source completion of the previous subscription.
|
Flux<T> |
repeat(java.util.function.BooleanSupplier predicate)
Repeatedly subscribe to the source if the predicate returns true after completion of the previous subscription.
|
Flux<T> |
repeat(long numRepeat)
Repeatedly subscribe to the source if the predicate returns true after completion of the previous subscription.
|
Flux<T> |
repeat(long numRepeat,
java.util.function.BooleanSupplier predicate)
Repeatedly subscribe to the source if the predicate returns true after completion of the previous
subscription.
|
Flux<T> |
repeatWhen(java.util.function.Function<Flux<java.lang.Long>,? extends org.reactivestreams.Publisher<?>> whenFactory)
Repeatedly subscribe to this
Flux when a companion sequence signals a number of emitted elements in
response to the flux completion signal. |
ConnectableFlux<T> |
replay()
Turn this
Flux into a hot source and cache last emitted signals for further Subscriber . |
ConnectableFlux<T> |
replay(java.time.Duration ttl)
Turn this
Flux into a connectable hot source and cache last emitted signals
for further Subscriber . |
ConnectableFlux<T> |
replay(int history)
Turn this
Flux into a connectable hot source and cache last emitted
signals for further Subscriber . |
ConnectableFlux<T> |
replay(int history,
java.time.Duration ttl)
Turn this
Flux into a connectable hot source and cache last emitted signals
for further Subscriber . |
ConnectableFlux<T> |
replayMillis(int history,
long ttl,
TimedScheduler timer)
Turn this
Flux into a connectable hot source and cache last emitted signals
for further Subscriber . |
ConnectableFlux<T> |
replayMillis(long ttl,
TimedScheduler timer)
Turn this
Flux into a connectable hot source and cache last emitted signals
for further Subscriber . |
Flux<T> |
retry()
Re-subscribes to this
Flux sequence if it signals any error
either indefinitely. |
Flux<T> |
retry(long numRetries)
Re-subscribes to this
Flux sequence if it signals any error
either indefinitely or a fixed number of times. |
Flux<T> |
retry(long numRetries,
java.util.function.Predicate<java.lang.Throwable> retryMatcher)
Re-subscribes to this
Flux sequence up to the specified number of retries if it signals any
error and the given Predicate matches otherwise push the error downstream. |
Flux<T> |
retry(java.util.function.Predicate<java.lang.Throwable> retryMatcher)
Re-subscribes to this
Flux sequence if it signals any error
and the given Predicate matches otherwise push the error downstream. |
Flux<T> |
retryWhen(java.util.function.Function<Flux<java.lang.Throwable>,? extends org.reactivestreams.Publisher<?>> whenFactory)
|
Flux<T> |
sample(java.time.Duration timespan)
Emit latest value for every given period of time.
|
<U> Flux<T> |
sample(org.reactivestreams.Publisher<U> sampler)
Sample this
Flux and emit its latest value whenever the sampler Publisher
signals a value. |
Flux<T> |
sampleFirst(java.time.Duration timespan)
Take a value from this
Flux then use the duration provided to skip other values. |
<U> Flux<T> |
sampleFirst(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<U>> samplerFactory)
Take a value from this
Flux then use the duration provided by a
generated Publisher to skip other values until that sampler Publisher signals. |
Flux<T> |
sampleFirstMillis(long timespan)
Take a value from this
Flux then use the duration provided to skip other values. |
Flux<T> |
sampleMillis(long timespan)
Emit latest value for every given period of ti,e.
|
<U> Flux<T> |
sampleTimeout(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<U>> throttlerFactory)
Emit the last value from this
Flux only if there were no new values emitted
during the time window provided by a publisher for that particular last value. |
<U> Flux<T> |
sampleTimeout(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<U>> throttlerFactory,
int maxConcurrency)
Emit the last value from this
Flux only if there were no newer values emitted
during the time window provided by a publisher for that particular last value. |
<A> Flux<A> |
scan(A initial,
java.util.function.BiFunction<A,? super T,A> accumulator)
Aggregate this
Flux values with the help of an accumulator BiFunction
and emits the intermediate results. |
Flux<T> |
scan(java.util.function.BiFunction<T,T,T> accumulator)
Accumulate this
Flux values with an accumulator BiFunction and
returns the intermediate results of this function. |
<A> Flux<A> |
scanWith(java.util.function.Supplier<A> initial,
java.util.function.BiFunction<A,? super T,A> accumulator)
Aggregate this
Flux values with the help of an accumulator BiFunction
and emits the intermediate results. |
Flux<T> |
share()
|
Mono<T> |
single()
Expect and emit a single item from this
Flux source or signal
NoSuchElementException (or a default generated value) for empty source,
IndexOutOfBoundsException for a multi-item source. |
Mono<T> |
single(T defaultValue)
Expect and emit a single item from this
Flux source or signal
NoSuchElementException (or a default value) for empty source,
IndexOutOfBoundsException for a multi-item source. |
Mono<T> |
singleOrEmpty()
Expect and emit a zero or single item from this
Flux source or
IndexOutOfBoundsException for a multi-item source. |
Flux<T> |
skip(java.time.Duration timespan)
Skip elements from this
Flux for the given time period. |
Flux<T> |
skip(long skipped)
Skip next the specified number of elements from this
Flux . |
Flux<T> |
skipLast(int n)
Skip the last specified number of elements from this
Flux . |
Flux<T> |
skipMillis(long timespan)
Skip elements from this
Flux for the given time period. |
Flux<T> |
skipMillis(long timespan,
TimedScheduler timer)
Skip elements from this
Flux for the given time period. |
Flux<T> |
skipUntil(java.util.function.Predicate<? super T> untilPredicate)
Skips values from this
Flux until a Predicate returns true for the
value. |
Flux<T> |
skipUntilOther(org.reactivestreams.Publisher<?> other)
Skip values from this
Flux until a specified Publisher signals
an onNext or onComplete. |
Flux<T> |
skipWhile(java.util.function.Predicate<? super T> skipPredicate)
Skips values from this
Flux while a Predicate returns true for the value. |
Flux<T> |
sort()
|
Flux<T> |
sort(java.util.Comparator<? super T> sortFunction)
|
Flux<T> |
startWith(java.lang.Iterable<? extends T> iterable)
Prepend the given
Iterable before this Flux sequence. |
Flux<T> |
startWith(org.reactivestreams.Publisher<? extends T> publisher)
Prepend the given
Publisher sequence before this Flux sequence. |
Flux<T> |
startWith(T... values)
Prepend the given values before this
Flux sequence. |
Cancellation |
subscribe()
Start the chain and request unbounded demand.
|
Cancellation |
subscribe(java.util.function.Consumer<? super T> consumer)
Subscribe a
Consumer to this Flux that will consume all the
sequence. |
Cancellation |
subscribe(java.util.function.Consumer<? super T> consumer,
java.util.function.Consumer<? super java.lang.Throwable> errorConsumer)
Subscribe
Consumer to this Flux that will consume all the
sequence. |
Cancellation |
subscribe(java.util.function.Consumer<? super T> consumer,
java.util.function.Consumer<? super java.lang.Throwable> errorConsumer,
java.lang.Runnable completeConsumer)
Subscribe
Consumer to this Flux that will consume all the
sequence. |
Cancellation |
subscribe(java.util.function.Consumer<? super T> consumer,
java.util.function.Consumer<? super java.lang.Throwable> errorConsumer,
java.lang.Runnable completeConsumer,
java.util.function.Consumer<? super org.reactivestreams.Subscription> subscriptionConsumer)
Subscribe
Consumer to this Flux that will consume all the
sequence. |
Cancellation |
subscribe(java.util.function.Consumer<? super T> consumer,
java.util.function.Consumer<? super java.lang.Throwable> errorConsumer,
java.lang.Runnable completeConsumer,
java.util.function.Consumer<? super org.reactivestreams.Subscription> subscriptionConsumer,
int prefetch)
Deprecated.
prefer using
limitRate(prefetch).subscribe(...) to
subscribe(..., prefetch) |
Cancellation |
subscribe(java.util.function.Consumer<? super T> consumer,
java.util.function.Consumer<? super java.lang.Throwable> errorConsumer,
java.lang.Runnable completeConsumer,
int prefetch)
Deprecated.
prefer using
limitRate(prefetch).subscribe(...) to
subscribe(..., prefetch) |
Cancellation |
subscribe(java.util.function.Consumer<? super T> consumer,
int prefetch)
Subscribe a
Consumer to this Flux that will consume all the
sequence. |
Cancellation |
subscribe(int prefetch)
Start the chain and request
prefetch demand |
Flux<T> |
subscribeOn(Scheduler scheduler)
Run subscribe, onSubscribe and request on a supplied
Scheduler |
<E extends org.reactivestreams.Subscriber<? super T>> |
subscribeWith(E subscriber)
A chaining
Publisher.subscribe(Subscriber) alternative to inline composition type conversion to a hot
emitter (e.g. |
Flux<T> |
switchIfEmpty(org.reactivestreams.Publisher<? extends T> alternate)
Provide an alternative if this sequence is completed without any data
|
<V> Flux<V> |
switchMap(java.util.function.Function<? super T,org.reactivestreams.Publisher<? extends V>> fn)
|
<V> Flux<V> |
switchMap(java.util.function.Function<? super T,org.reactivestreams.Publisher<? extends V>> fn,
int prefetch)
|
<E extends java.lang.Throwable> |
switchOnError(java.lang.Class<E> type,
org.reactivestreams.Publisher<? extends T> fallback)
Subscribe to the given fallback
Publisher if an error matching the given
type is observed on this Flux |
Flux<T> |
switchOnError(java.util.function.Predicate<? super java.lang.Throwable> predicate,
org.reactivestreams.Publisher<? extends T> fallback)
Subscribe to the given fallback
Publisher if an error matching the given
predicate is observed on this Flux |
Flux<T> |
switchOnError(org.reactivestreams.Publisher<? extends T> fallback)
Subscribe to the given fallback
Publisher if an error is observed on this Flux |
static <T> Flux<T> |
switchOnNext(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> mergedPublishers)
Build a
FluxProcessor whose data are emitted by the most recent emitted Publisher . |
static <T> Flux<T> |
switchOnNext(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> mergedPublishers,
int prefetch)
Build a
FluxProcessor whose data are emitted by the most recent emitted Publisher . |
Flux<T> |
take(java.time.Duration timespan)
Relay values from this
Flux until the given time period elapses. |
Flux<T> |
take(long n)
Take only the first N values from this
Flux . |
Flux<T> |
takeLast(int n)
Emit the last N values this
Flux emitted before its completion. |
Flux<T> |
takeMillis(long timespan)
Relay values from this
Flux until the given time period elapses. |
Flux<T> |
takeMillis(long timespan,
TimedScheduler timer)
Relay values from this
Flux until the given time period elapses. |
Flux<T> |
takeUntil(java.util.function.Predicate<? super T> predicate)
Relay values from this
Flux until the given Predicate matches. |
Flux<T> |
takeUntilOther(org.reactivestreams.Publisher<?> other)
Relay values from this
Flux until the given Publisher emits. |
Flux<T> |
takeWhile(java.util.function.Predicate<? super T> continuePredicate)
Relay values while a predicate returns
FALSE for the values (checked before each value is delivered).
|
Mono<java.lang.Void> |
then()
Return a
Mono<Void> that completes when this Flux completes. |
Mono<java.lang.Void> |
then(org.reactivestreams.Publisher<java.lang.Void> other)
Deprecated.
use
thenEmpty(Publisher) instead, this alias will be
removed in 3.1.0 |
Mono<java.lang.Void> |
then(java.util.function.Supplier<? extends org.reactivestreams.Publisher<java.lang.Void>> afterSupplier)
|
Mono<java.lang.Void> |
thenEmpty(org.reactivestreams.Publisher<java.lang.Void> other)
Return a
Mono<Void> that waits for this Flux to complete then
for a supplied Publisher<Void> to also complete. |
<V> Flux<V> |
thenMany(org.reactivestreams.Publisher<V> other)
|
<V> Flux<V> |
thenMany(java.util.function.Supplier<? extends org.reactivestreams.Publisher<V>> afterSupplier)
|
Flux<T> |
timeout(java.time.Duration timeout)
Signal a
TimeoutException in case a per-item period fires before the
next item arrives from this Flux . |
Flux<T> |
timeout(java.time.Duration timeout,
org.reactivestreams.Publisher<? extends T> fallback)
Switch to a fallback
Publisher in case a per-item period
fires before the next item arrives from this Flux . |
<U> Flux<T> |
timeout(org.reactivestreams.Publisher<U> firstTimeout)
Signal a
TimeoutException in case a first item from this Flux has
not been emitted before the given Publisher emits. |
<U,V> Flux<T> |
timeout(org.reactivestreams.Publisher<U> firstTimeout,
java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<V>> nextTimeoutFactory)
Signal a
TimeoutException in case a first item from this Flux has
not been emitted before the given Publisher emits. |
<U,V> Flux<T> |
timeout(org.reactivestreams.Publisher<U> firstTimeout,
java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<V>> nextTimeoutFactory,
org.reactivestreams.Publisher<? extends T> fallback)
Switch to a fallback
Publisher in case a first item from this Flux has
not been emitted before the given Publisher emits. |
Flux<T> |
timeoutMillis(long timeout)
Signal a
TimeoutException error in case a per-item period in milliseconds fires
before the next item arrives from this Flux . |
Flux<T> |
timeoutMillis(long timeout,
org.reactivestreams.Publisher<? extends T> fallback)
Switch to a fallback
Publisher in case a per-item period
fires before the next item arrives from this Flux . |
Flux<T> |
timeoutMillis(long timeout,
org.reactivestreams.Publisher<? extends T> fallback,
TimedScheduler timer)
Switch to a fallback
Publisher in case a per-item period
fires before the next item arrives from this Flux . |
Flux<T> |
timeoutMillis(long timeout,
TimedScheduler timer)
Signal a
TimeoutException error in case a per-item period in milliseconds fires
before the next item arrives from this Flux . |
Flux<Tuple2<java.lang.Long,T>> |
timestamp()
|
Flux<Tuple2<java.lang.Long,T>> |
timestamp(TimedScheduler scheduler)
|
java.lang.Iterable<T> |
toIterable()
Transform this
Flux into a lazy Iterable blocking on next calls. |
java.lang.Iterable<T> |
toIterable(long batchSize)
Transform this
Flux into a lazy Iterable blocking on next calls. |
java.lang.Iterable<T> |
toIterable(long batchSize,
java.util.function.Supplier<java.util.Queue<T>> queueProvider)
Transform this
Flux into a lazy Iterable blocking on next calls. |
java.util.stream.Stream<T> |
toStream()
Transform this
Flux into a lazy Stream blocking on next calls. |
java.util.stream.Stream<T> |
toStream(int batchSize)
Transform this
Flux into a lazy Stream blocking on next calls. |
java.lang.String |
toString() |
<V> Flux<V> |
transform(java.util.function.Function<? super Flux<T>,? extends org.reactivestreams.Publisher<V>> transformer)
|
static <T,D> Flux<T> |
using(java.util.concurrent.Callable<? extends D> resourceSupplier,
java.util.function.Function<? super D,? extends org.reactivestreams.Publisher<? extends T>> sourceSupplier,
java.util.function.Consumer<? super D> resourceCleanup)
Uses a resource, generated by a supplier for each individual Subscriber, while streaming the values from a
Publisher derived from the same resource and makes sure the resource is released if the sequence terminates or
the Subscriber cancels.
|
static <T,D> Flux<T> |
using(java.util.concurrent.Callable<? extends D> resourceSupplier,
java.util.function.Function<? super D,? extends org.reactivestreams.Publisher<? extends T>> sourceSupplier,
java.util.function.Consumer<? super D> resourceCleanup,
boolean eager)
Uses a resource, generated by a supplier for each individual Subscriber, while streaming the values from a
Publisher derived from the same resource and makes sure the resource is released if the sequence terminates or
the Subscriber cancels.
|
Flux<Flux<T>> |
window()
|
Flux<Flux<T>> |
window(java.time.Duration timespan)
Split this
Flux sequence into continuous, non-overlapping windows delimited by a given period. |
Flux<Flux<T>> |
window(java.time.Duration timespan,
java.time.Duration timeshift)
|
Flux<Flux<T>> |
window(int maxSize)
|
Flux<Flux<T>> |
window(int maxSize,
java.time.Duration timespan)
|
Flux<Flux<T>> |
window(int maxSize,
int skip)
|
Flux<Flux<T>> |
window(org.reactivestreams.Publisher<?> boundary)
Split this
Flux sequence into continuous, non-overlapping windows
where the window boundary is signalled by another Publisher |
<U,V> Flux<Flux<T>> |
window(org.reactivestreams.Publisher<U> bucketOpening,
java.util.function.Function<? super U,? extends org.reactivestreams.Publisher<V>> closeSelector)
Split this
Flux sequence into potentially overlapping windows controlled by items of a
start Publisher and end Publisher derived from the start values. |
Flux<Flux<T>> |
windowMillis(int maxSize,
long timespan)
|
Flux<Flux<T>> |
windowMillis(int maxSize,
long timespan,
TimedScheduler timer)
|
Flux<Flux<T>> |
windowMillis(long timespan)
Split this
Flux sequence into continuous, non-overlapping windows delimited by a given period. |
Flux<Flux<T>> |
windowMillis(long timespan,
long timeshift,
TimedScheduler timer)
|
Flux<Flux<T>> |
windowMillis(long timespan,
TimedScheduler timer)
Split this
Flux sequence into continuous, non-overlapping windows delimited by a given period. |
<U,R> Flux<R> |
withLatestFrom(org.reactivestreams.Publisher<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> resultSelector)
Combine values from this
Flux with values from another
Publisher through a BiFunction and emits the result. |
static <I,O> Flux<O> |
zip(java.util.function.Function<? super java.lang.Object[],? extends O> combinator,
int prefetch,
org.reactivestreams.Publisher<? extends I>... sources)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static <I,O> Flux<O> |
zip(java.util.function.Function<? super java.lang.Object[],? extends O> combinator,
org.reactivestreams.Publisher<? extends I>... sources)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static Flux<Tuple2> |
zip(java.lang.Iterable<? extends org.reactivestreams.Publisher<?>> sources)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static <O> Flux<O> |
zip(java.lang.Iterable<? extends org.reactivestreams.Publisher<?>> sources,
java.util.function.Function<? super java.lang.Object[],? extends O> combinator)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static <O> Flux<O> |
zip(java.lang.Iterable<? extends org.reactivestreams.Publisher<?>> sources,
int prefetch,
java.util.function.Function<? super java.lang.Object[],? extends O> combinator)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static <TUPLE extends Tuple2,V> |
zip(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<?>> sources,
java.util.function.Function<? super TUPLE,? extends V> combinator)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static <T1,T2> Flux<Tuple2<T1,T2>> |
zip(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static <T1,T2,O> Flux<O> |
zip(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2,
java.util.function.BiFunction<? super T1,? super T2,? extends O> combinator)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static <T1,T2,T3> Flux<Tuple3<T1,T2,T3>> |
zip(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2,
org.reactivestreams.Publisher<? extends T3> source3)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static <T1,T2,T3,T4> |
zip(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2,
org.reactivestreams.Publisher<? extends T3> source3,
org.reactivestreams.Publisher<? extends T4> source4)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static <T1,T2,T3,T4,T5> |
zip(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2,
org.reactivestreams.Publisher<? extends T3> source3,
org.reactivestreams.Publisher<? extends T4> source4,
org.reactivestreams.Publisher<? extends T5> source5)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
static <T1,T2,T3,T4,T5,T6> |
zip(org.reactivestreams.Publisher<? extends T1> source1,
org.reactivestreams.Publisher<? extends T2> source2,
org.reactivestreams.Publisher<? extends T3> source3,
org.reactivestreams.Publisher<? extends T4> source4,
org.reactivestreams.Publisher<? extends T5> source5,
org.reactivestreams.Publisher<? extends T6> source6)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
<T2> Flux<Tuple2<T,T2>> |
zipWith(org.reactivestreams.Publisher<? extends T2> source2)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
<T2,V> Flux<V> |
zipWith(org.reactivestreams.Publisher<? extends T2> source2,
java.util.function.BiFunction<? super T,? super T2,? extends V> combinator)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
<T2> Flux<Tuple2<T,T2>> |
zipWith(org.reactivestreams.Publisher<? extends T2> source2,
int prefetch)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
<T2,V> Flux<V> |
zipWith(org.reactivestreams.Publisher<? extends T2> source2,
int prefetch,
java.util.function.BiFunction<? super T,? super T2,? extends V> combinator)
"Step-Merge" especially useful in Scatter-Gather scenarios.
|
<T2> Flux<Tuple2<T,T2>> |
zipWithIterable(java.lang.Iterable<? extends T2> iterable)
|
<T2,V> Flux<V> |
zipWithIterable(java.lang.Iterable<? extends T2> iterable,
java.util.function.BiFunction<? super T,? super T2,? extends V> zipper)
|
@SafeVarargs public static <T,V> Flux<V> combineLatest(java.util.function.Function<java.lang.Object[],V> combinator, org.reactivestreams.Publisher<? extends T>... sources)
Flux
whose data are generated by the combination of the most recent published values from all
publishers.
T
- type of the value from sourcesV
- The produced output after transformation by the given combinatorsources
- The upstreams Publisher
to subscribe to.combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
based on the produced combinations , 3.0@SafeVarargs public static <T,V> Flux<V> combineLatest(java.util.function.Function<java.lang.Object[],V> combinator, int prefetch, org.reactivestreams.Publisher<? extends T>... sources)
Flux
whose data are generated by the combination of the most recent published values from all
publishers.
T
- type of the value from sourcesV
- The produced output after transformation by the given combinatorsources
- The upstreams Publisher
to subscribe to.prefetch
- demand produced to each combined source Publisher
combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
based on the produced combinations , 3.0public static <T1,T2,V> Flux<V> combineLatest(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2, java.util.function.BiFunction<? super T1,? super T2,? extends V> combinator)
Flux
whose data are generated by the combination of the most recent published values from all
publishers.
T1
- type of the value from source1T2
- type of the value from source2V
- The produced output after transformation by the given combinatorsource1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
based on the produced valuepublic static <T1,T2,T3,V> Flux<V> combineLatest(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2, org.reactivestreams.Publisher<? extends T3> source3, java.util.function.Function<java.lang.Object[],V> combinator)
Flux
whose data are generated by the combination of the most recent published values from all
publishers.
T1
- type of the value from source1T2
- type of the value from source2T3
- type of the value from source3V
- The produced output after transformation by the given combinatorsource1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.source3
- The third upstream Publisher
to subscribe to.combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
based on the produced valuepublic static <T1,T2,T3,T4,V> Flux<V> combineLatest(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2, org.reactivestreams.Publisher<? extends T3> source3, org.reactivestreams.Publisher<? extends T4> source4, java.util.function.Function<java.lang.Object[],V> combinator)
Flux
whose data are generated by the combination of the most recent published values from all
publishers.
T1
- type of the value from source1T2
- type of the value from source2T3
- type of the value from source3T4
- type of the value from source4V
- The produced output after transformation by the given combinatorsource1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.source3
- The third upstream Publisher
to subscribe to.source4
- The fourth upstream Publisher
to subscribe to.combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
based on the produced valuepublic static <T1,T2,T3,T4,T5,V> Flux<V> combineLatest(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2, org.reactivestreams.Publisher<? extends T3> source3, org.reactivestreams.Publisher<? extends T4> source4, org.reactivestreams.Publisher<? extends T5> source5, java.util.function.Function<java.lang.Object[],V> combinator)
Flux
whose data are generated by the combination of the most recent published values from all
publishers.
T1
- type of the value from source1T2
- type of the value from source2T3
- type of the value from source3T4
- type of the value from source4T5
- type of the value from source5V
- The produced output after transformation by the given combinatorsource1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.source3
- The third upstream Publisher
to subscribe to.source4
- The fourth upstream Publisher
to subscribe to.source5
- The fifth upstream Publisher
to subscribe to.combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
based on the produced valuepublic static <T1,T2,T3,T4,T5,T6,V> Flux<V> combineLatest(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2, org.reactivestreams.Publisher<? extends T3> source3, org.reactivestreams.Publisher<? extends T4> source4, org.reactivestreams.Publisher<? extends T5> source5, org.reactivestreams.Publisher<? extends T6> source6, java.util.function.Function<java.lang.Object[],V> combinator)
Flux
whose data are generated by the combination of the most recent published values from all
publishers.
T1
- type of the value from source1T2
- type of the value from source2T3
- type of the value from source3T4
- type of the value from source4T5
- type of the value from source5T6
- type of the value from source6V
- The produced output after transformation by the given combinatorsource1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.source3
- The third upstream Publisher
to subscribe to.source4
- The fourth upstream Publisher
to subscribe to.source5
- The fifth upstream Publisher
to subscribe to.source6
- The sixth upstream Publisher
to subscribe to.combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
based on the produced valuepublic static <T,V> Flux<V> combineLatest(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends T>> sources, java.util.function.Function<java.lang.Object[],V> combinator)
Flux
whose data are generated by the combination of the most recent published values from all
publishers.
T
- The common base type of the source sequencesV
- The produced output after transformation by the given combinatorsources
- The list of upstream Publisher
to subscribe to.combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
based on the produced value , 3.0public static <T,V> Flux<V> combineLatest(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends T>> sources, int prefetch, java.util.function.Function<java.lang.Object[],V> combinator)
Flux
whose data are generated by the combination of the most recent published values from all
publishers.
T
- The common base type of the source sequencesV
- The produced output after transformation by the given combinatorsources
- The list of upstream Publisher
to subscribe to.prefetch
- demand produced to each combined source Publisher
combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
based on the produced value , 3.0public static <T> Flux<T> concat(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends T>> sources)
Iterator
on Publisher.subscribe(org.reactivestreams.Subscriber<? super T>)
from the passed Iterable
until Iterator.hasNext()
returns false. A complete signal from each source will delimit the individual sequences and will be eventually
passed to the returned Publisher.
T
- The source type of the data sequencesources
- The Publisher
of Publisher
to concatFlux
concatenating all source sequencespublic static <T> Flux<T> concat(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources)
Publisher
.
A complete signal from each source will delimit the individual sequences and will be eventually
passed to the returned Publisher
which will stop listening if the main sequence has also completed.
T
- The source type of the data sequencesources
- The Publisher
of Publisher
to concatFlux
concatenating all inner sources sequences until complete or errorpublic static <T> Flux<T> concat(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources, int prefetch)
Publisher
.
A complete signal from each source will delimit the individual sequences and will be eventually
passed to the returned Publisher
which will stop listening if the main sequence has also completed.
T
- The source type of the data sequencesources
- The Publisher
of Publisher
to concatprefetch
- the inner source request sizeFlux
concatenating all inner sources sequences until complete or error@SafeVarargs public static <T> Flux<T> concat(org.reactivestreams.Publisher<? extends T>... sources)
Publisher
array.
A complete signal from each source will delimit the individual sequences and will be eventually
passed to the returned Publisher.
T
- The source type of the data sequencesources
- The Publisher
of Publisher
to concatFlux
concatenating all source sequencespublic static <T> Flux<T> concatDelayError(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources)
Publisher
.
A complete signal from each source will delimit the individual sequences and will be eventually
passed to the returned Publisher
which will stop listening if the main sequence has also completed.
T
- The source type of the data sequencesources
- The Publisher
of Publisher
to concatFlux
concatenating all inner sources sequences until complete or errorpublic static <T> Flux<T> concatDelayError(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources, int prefetch)
Publisher
.
A complete signal from each source will delimit the individual sequences and will be eventually
passed to the returned Publisher
which will stop listening if the main sequence has also completed.
T
- The source type of the data sequencesources
- The Publisher
of Publisher
to concatprefetch
- the inner source request sizeFlux
concatenating all inner sources sequences until complete or errorpublic static <T> Flux<T> concatDelayError(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources, boolean delayUntilEnd, int prefetch)
Publisher
.
A complete signal from each source will delimit the individual sequences and will be eventually
passed to the returned Publisher
which will stop listening if the main sequence has also completed.
Errors will be delayed after the current concat backlog if delayUntilEnd is
false or after all sources if delayUntilEnd is true.
T
- The source type of the data sequencesources
- The Publisher
of Publisher
to concatdelayUntilEnd
- delay error until all sources have been consumed instead of
after the current sourceprefetch
- the inner source request sizeFlux
concatenating all inner sources sequences until complete or error@SafeVarargs public static <T> Flux<T> concatDelayError(org.reactivestreams.Publisher<? extends T>... sources)
Publisher
array.
A complete signal from each source will delimit the individual sequences and will be eventually
passed to the returned Publisher.
Any error will be delayed until all sources have been concatenated.
T
- The source type of the data sequencesources
- The Publisher
of Publisher
to concatFlux
concatenating all source sequencespublic static <T> Flux<T> create(java.util.function.Consumer<? super FluxSink<T>> emitter)
This Flux factory is useful if one wants to adapt some other a multi-valued async API and not worry about cancellation and backpressure. For example:
Handles backpressure by buffering all signals if the downstream can't keep up.
Flux.<String>create(emitter -> {
ActionListener al = e -> {
emitter.next(textField.getText());
};
// without cancellation support:
button.addActionListener(al);
// with cancellation support:
button.addActionListener(al);
emitter.setCancellation(() -> {
button.removeListener(al);
});
});
T
- the value typeemitter
- the consumer that will receive a FluxSink for each individual Subscriber.Flux
public static <T> Flux<T> create(java.util.function.Consumer<? super FluxSink<T>> emitter, FluxSink.OverflowStrategy backpressure)
This Flux factory is useful if one wants to adapt some other a multi-valued async API and not worry about cancellation and backpressure. For example:
Flux.<String>create(emitter -> {
ActionListener al = e -> {
emitter.next(textField.getText());
};
// without cancellation support:
button.addActionListener(al);
// with cancellation support:
button.addActionListener(al);
emitter.setCancellation(() -> {
button.removeListener(al);
});
}, FluxSink.OverflowStrategy.LATEST);
T
- the value typebackpressure
- the backpressure mode, see FluxSink.OverflowStrategy
for the avilable backpressure modesemitter
- the consumer that will receive a FluxSink for each individual Subscriber.Flux
public static <T> Flux<T> defer(java.util.function.Supplier<? extends org.reactivestreams.Publisher<T>> supplier)
Publisher
everytime subscribe is called on the returned flux. The passed Supplier
will be invoked and it's up to the developer to choose to return a new instance of a Publisher
or reuse
one effecitvely behaving like from(Publisher)
.
public static <T> Flux<T> empty()
Flux
that completes without emitting any item.
T
- the reified type of the target Subscriber
Flux
public static <T> Flux<T> error(java.lang.Throwable error)
Flux
that completes with the specified error.
T
- the reified type of the target Subscriber
error
- the error to signal to each Subscriber
Flux
public static <O> Flux<O> error(java.lang.Throwable throwable, boolean whenRequested)
Flux
that will only emit an error signal to any new subscriber.
O
- the output typethrowable
- the error to signal to each Subscriber
whenRequested
- if true, will onError on the first request instead of subscribe().Flux
@SafeVarargs public static <I> Flux<I> firstEmitting(org.reactivestreams.Publisher<? extends I>... sources)
I
- The source type of the data sequencesources
- The competing source publishersFlux
eventually subscribed to one of the sources or emptypublic static <I> Flux<I> firstEmitting(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends I>> sources)
I
- The source type of the data sequencesources
- The competing source publishersFlux
eventually subscribed to one of the sources or emptypublic static <T> Flux<T> from(org.reactivestreams.Publisher<? extends T> source)
T
- the source sequence typesource
- the source to decorateFlux
public static <T> Flux<T> fromArray(T[] array)
T
- the Publisher
type to streamarray
- the array to read data fromFlux
public static <T> Flux<T> fromIterable(java.lang.Iterable<? extends T> it)
Flux
that emits the items contained in the provided Iterable
.
A new iterator will be created for each subscriber.
T
- the Iterable
type to streamit
- the Iterable
to read data fromFlux
public static <T> Flux<T> fromStream(java.util.stream.Stream<? extends T> s)
Flux
that emits the items contained in the provided Stream
.
A new iterator will be created for each subscriber.
T
- the Stream
type to fluxs
- the Stream
to read data fromFlux
public static <T> Flux<T> generate(java.util.function.Consumer<SynchronousSink<T>> generator)
T
- the value type emittedgenerator
- the consumer called with the SynchronousSink
API instanceFlux
publisher ready to be subscribedpublic static <T,S> Flux<T> generate(java.util.concurrent.Callable<S> stateSupplier, java.util.function.BiFunction<S,SynchronousSink<T>,S> generator)
stateSupplier
may return null
.
T
- the value type emittedS
- the custom state per subscriberstateSupplier
- called for each incoming Supplier to provide the initial state for the generator bifunctiongenerator
- the bifunction called with the current state, the SynchronousSink API instance and is
expected to return a (new) state.Flux
publisher ready to be subscribedpublic static <T,S> Flux<T> generate(java.util.concurrent.Callable<S> stateSupplier, java.util.function.BiFunction<S,SynchronousSink<T>,S> generator, java.util.function.Consumer<? super S> stateConsumer)
stateSupplier
may return null
but your stateConsumer
should be prepared to
handle it.
T
- the value type emittedS
- the custom state per subscriberstateSupplier
- called for each incoming Supplier to provide the initial state for the generator bifunctiongenerator
- the bifunction called with the current state, the SynchronousSink API instance and is
expected to return a (new) state.stateConsumer
- called after the generator has terminated or the downstream cancelled, receiving the last
state to be handled (i.e., release resources or do other cleanup).Flux
publisher ready to be subscribedpublic static Flux<java.lang.Long> interval(java.time.Duration period)
Flux
that emits an ever incrementing long starting with 0 every period on
the global timer. If demand is not produced in time, an onError will be signalled. The Flux
will never
complete.
period
- The duration to wait before the next incrementFlux
public static Flux<java.lang.Long> interval(java.time.Duration delay, java.time.Duration period)
Flux
that emits an ever incrementing long starting with 0 every N period of time unit on
a global timer. If demand is not produced in time, an onError will be signalled. The Flux
will never
complete.
delay
- the delay to wait before emitting 0lperiod
- the period before each following incrementFlux
public static Flux<java.lang.Long> intervalMillis(long period)
Flux
that emits an ever incrementing long starting with 0 every N milliseconds on
the given timer. If demand is not produced in time, an onError will be signalled. The Flux
will never
complete.
period
- The number of milliseconds to wait before the next incrementFlux
public static Flux<java.lang.Long> intervalMillis(long period, TimedScheduler timer)
Flux
that emits an ever incrementing long starting with 0 every N milliseconds on
the given timer. If demand is not produced in time, an onError will be signalled. The Flux
will never
complete.
period
- The duration in milliseconds to wait before the next incrementtimer
- a TimedScheduler
instanceFlux
public static Flux<java.lang.Long> intervalMillis(long delay, long period)
Flux
that emits an ever incrementing long starting with 0 every N period of time unit on
a global timer. If demand is not produced in time, an onError will be signalled. The Flux
will never
complete.
delay
- the delay in milliseconds to wait before emitting 0lperiod
- the period in milliseconds before each following incrementFlux
public static Flux<java.lang.Long> intervalMillis(long delay, long period, TimedScheduler timer)
Flux
that emits an ever incrementing long starting with 0 every N period of time unit on
the given timer. If demand is not produced in time, an onError will be signalled. The Flux
will never
complete.
delay
- the timespan in milliseconds to wait before emitting 0lperiod
- the period in milliseconds before each following incrementtimer
- the TimedScheduler
to schedule onFlux
@SafeVarargs public static <T> Flux<T> just(T... data)
Flux
that emits the specified items and then complete.
T
- the emitted data typedata
- the consecutive data objects to emitFlux
public static <T> Flux<T> just(T data)
Flux
that will only emit the passed data then onComplete.
T
- the emitted data typedata
- the unique data to emitFlux
public static <T> Flux<T> merge(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> source)
Publisher
sequences by the passed Publisher
into an interleaved merged sequence.
T
- the merged typesource
- a Publisher
of Publisher
sequence to mergeFlux
public static <T> Flux<T> merge(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> source, int concurrency)
Publisher
sequences by the passed Publisher
into an interleaved merged sequence.
T
- the merged typesource
- a Publisher
of Publisher
sequence to mergeconcurrency
- the request produced to the main source thus limiting concurrent merge backlogFlux
public static <T> Flux<T> merge(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> source, int concurrency, int prefetch)
Publisher
sequences by the passed Publisher
into an interleaved merged sequence.
T
- the merged typesource
- a Publisher
of Publisher
sequence to mergeconcurrency
- the request produced to the main source thus limiting concurrent merge backlogprefetch
- the inner source request sizeFlux
public static <I> Flux<I> merge(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends I>> sources)
Publisher
sequences from the passed Iterable
into an interleaved merged sequence.
Iterable.iterator()
will be called for each Publisher.subscribe(org.reactivestreams.Subscriber<? super T>)
.
I
- The source type of the data sequencesources
- the Iterable
to lazily iterate on Publisher.subscribe(Subscriber)
Flux
publisher ready to be subscribed@SafeVarargs public static <I> Flux<I> merge(org.reactivestreams.Publisher<? extends I>... sources)
Publisher
sequences from the passed Publisher
array into an interleaved merged
sequence.
I
- The source type of the data sequencesources
- the Publisher
array to iterate on Publisher.subscribe(Subscriber)
Flux
publisher ready to be subscribed@SafeVarargs public static <I> Flux<I> merge(int prefetch, org.reactivestreams.Publisher<? extends I>... sources)
Publisher
sequences from the passed Publisher
array into an interleaved merged
sequence.
I
- The source type of the data sequencesources
- the Publisher
array to iterate on Publisher.subscribe(Subscriber)
prefetch
- the inner source request sizeFlux
publisher ready to be subscribed@SafeVarargs public static <I> Flux<I> merge(int prefetch, boolean delayError, org.reactivestreams.Publisher<? extends I>... sources)
Publisher
sequences from the passed Publisher
array into an interleaved merged
sequence.
I
- The source type of the data sequencesources
- the Publisher
array to iterate on Publisher.subscribe(Subscriber)
prefetch
- the inner source request sizedelayError
- should any error be delayed after current merge backlogFlux
publisher ready to be subscribedpublic static <T> Flux<T> mergeSequential(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources)
Publisher
sequences by the passed Publisher
into
an ordered merged sequence. The inner publishers are subscribed to eagerly, but
their emitted values are merged into the final sequence in subscription order.
T
- the merged typesources
- a Publisher
of Publisher
sequence to mergeFlux
public static <T> Flux<T> mergeSequential(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> sources, boolean delayError, int maxConcurrency, int prefetch)
Publisher
sequences by the passed Publisher
into
an ordered merged sequence. The inner publishers are subscribed to eagerly, but
their emitted values are merged into the final sequence in subscription order.
T
- the merged typesources
- a Publisher
of Publisher
sequence to mergedelayError
- should any error be delayed after current merge backlogprefetch
- the inner source request sizemaxConcurrency
- the request produced to the main source thus limiting concurrent merge backlogFlux
@SafeVarargs public static <I> Flux<I> mergeSequential(org.reactivestreams.Publisher<? extends I>... sources)
Publisher
sequences into an ordered merged sequence.
The inner publishers are subscribed to eagerly, but their emitted values are merged
into the final sequence in subscription order.
I
- the merged typesources
- a number of Publisher
sequences to mergeFlux
@SafeVarargs public static <I> Flux<I> mergeSequential(int prefetch, boolean delayError, org.reactivestreams.Publisher<? extends I>... sources)
Publisher
sequences into an ordered merged sequence.
The inner publishers are subscribed to eagerly, but their emitted values are merged
into the final sequence in subscription order.
I
- the merged typedelayError
- should any error be delayed after current merge backlogprefetch
- the inner source request sizesources
- a number of Publisher
sequences to mergeFlux
public static <I> Flux<I> mergeSequential(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends I>> sources)
Publisher
sequences from an Iterable
into an ordered merged
sequence. The inner publishers are subscribed to eagerly, but their emitted values
are merged into the final sequence in subscription order.
I
- the merged typesources
- an Iterable
of Publisher
sequences to mergeFlux
public static <I> Flux<I> mergeSequential(java.lang.Iterable<? extends org.reactivestreams.Publisher<? extends I>> sources, boolean delayError, int maxConcurrency, int prefetch)
Publisher
sequences from an Iterable
into an ordered merged
sequence. The inner publishers are subscribed to eagerly, but their emitted values
are merged into the final sequence in subscription order.
I
- the merged typesources
- an Iterable
of Publisher
sequences to mergedelayError
- should any error be delayed after current merge backlogmaxConcurrency
- the request produced to the main source thus limiting concurrent merge backlogprefetch
- the inner source request sizeFlux
public static <T> Flux<T> never()
Flux
that will never signal any data, error or completion signal.
T
- the Subscriber
type targetFlux
public static Flux<java.lang.Integer> range(int start, int count)
Flux
that will only emit a sequence of incrementing integer from start
to start + count
then complete.
start
- the first integer to be emitcount
- the number ot times to emit an increment including the first valueFlux
public static <T> Flux<T> switchOnNext(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> mergedPublishers)
FluxProcessor
whose data are emitted by the most recent emitted Publisher
. The Flux
will complete once both the publishers source and the last switched to Publisher
have completed.
T
- the produced typemergedPublishers
- The Publisher
of switching Publisher
to subscribe to.FluxProcessor
accepting publishers and producing Tpublic static <T> Flux<T> switchOnNext(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<? extends T>> mergedPublishers, int prefetch)
FluxProcessor
whose data are emitted by the most recent emitted Publisher
. The Flux
will complete once both the publishers source and the last switched to Publisher
have completed.
T
- the produced typemergedPublishers
- The Publisher
of switching Publisher
to subscribe to.prefetch
- the inner source request sizeFluxProcessor
accepting publishers and producing Tpublic static <T,D> Flux<T> using(java.util.concurrent.Callable<? extends D> resourceSupplier, java.util.function.Function<? super D,? extends org.reactivestreams.Publisher<? extends T>> sourceSupplier, java.util.function.Consumer<? super D> resourceCleanup)
Eager resource cleanup happens just before the source termination and exceptions raised by the cleanup Consumer may override the terminal even.
T
- emitted typeD
- resource typeresourceSupplier
- a Callable
that is called on subscribesourceSupplier
- a Publisher
factory derived from the supplied resourceresourceCleanup
- invoked on completionFlux
public static <T,D> Flux<T> using(java.util.concurrent.Callable<? extends D> resourceSupplier, java.util.function.Function<? super D,? extends org.reactivestreams.Publisher<? extends T>> sourceSupplier, java.util.function.Consumer<? super D> resourceCleanup, boolean eager)
T
- emitted typeD
- resource typeresourceSupplier
- a Callable
that is called on subscribesourceSupplier
- a Publisher
factory derived from the supplied resourceresourceCleanup
- invoked on completioneager
- true to clean before terminating downstream subscriberspublic static <T1,T2,O> Flux<O> zip(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2, java.util.function.BiFunction<? super T1,? super T2,? extends O> combinator)
T1
- type of the value from source1T2
- type of the value from source2O
- The produced output after transformation by the combinatorsource1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.combinator
- The aggregate function that will receive a unique value from each upstream and return the
value to signal downstreamFlux
public static <T1,T2> Flux<Tuple2<T1,T2>> zip(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2)
T1
- type of the value from source1T2
- type of the value from source2source1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.Flux
public static <T1,T2,T3> Flux<Tuple3<T1,T2,T3>> zip(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2, org.reactivestreams.Publisher<? extends T3> source3)
T1
- type of the value from source1T2
- type of the value from source2T3
- type of the value from source3source1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.source3
- The third upstream Publisher
to subscribe to.Flux
public static <T1,T2,T3,T4> Flux<Tuple4<T1,T2,T3,T4>> zip(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2, org.reactivestreams.Publisher<? extends T3> source3, org.reactivestreams.Publisher<? extends T4> source4)
T1
- type of the value from source1T2
- type of the value from source2T3
- type of the value from source3T4
- type of the value from source4source1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.source3
- The third upstream Publisher
to subscribe to.source4
- The fourth upstream Publisher
to subscribe to.Flux
public static <T1,T2,T3,T4,T5> Flux<Tuple5<T1,T2,T3,T4,T5>> zip(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2, org.reactivestreams.Publisher<? extends T3> source3, org.reactivestreams.Publisher<? extends T4> source4, org.reactivestreams.Publisher<? extends T5> source5)
T1
- type of the value from source1T2
- type of the value from source2T3
- type of the value from source3T4
- type of the value from source4T5
- type of the value from source5source1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.source3
- The third upstream Publisher
to subscribe to.source4
- The fourth upstream Publisher
to subscribe to.source5
- The fifth upstream Publisher
to subscribe to.Flux
public static <T1,T2,T3,T4,T5,T6> Flux<Tuple6<T1,T2,T3,T4,T5,T6>> zip(org.reactivestreams.Publisher<? extends T1> source1, org.reactivestreams.Publisher<? extends T2> source2, org.reactivestreams.Publisher<? extends T3> source3, org.reactivestreams.Publisher<? extends T4> source4, org.reactivestreams.Publisher<? extends T5> source5, org.reactivestreams.Publisher<? extends T6> source6)
T1
- type of the value from source1T2
- type of the value from source2T3
- type of the value from source3T4
- type of the value from source4T5
- type of the value from source5T6
- type of the value from source6source1
- The first upstream Publisher
to subscribe to.source2
- The second upstream Publisher
to subscribe to.source3
- The third upstream Publisher
to subscribe to.source4
- The fourth upstream Publisher
to subscribe to.source5
- The fifth upstream Publisher
to subscribe to.source6
- The sixth upstream Publisher
to subscribe to.Flux
public static Flux<Tuple2> zip(java.lang.Iterable<? extends org.reactivestreams.Publisher<?>> sources)
Iterable.iterator()
will be called on each Publisher.subscribe(Subscriber)
.
sources
- the Iterable
to iterate on Publisher.subscribe(Subscriber)
Flux
public static <O> Flux<O> zip(java.lang.Iterable<? extends org.reactivestreams.Publisher<?>> sources, java.util.function.Function<? super java.lang.Object[],? extends O> combinator)
Iterable.iterator()
will be called on each Publisher.subscribe(Subscriber)
.
O
- the combined produced typesources
- the Iterable
to iterate on Publisher.subscribe(Subscriber)
combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
public static <O> Flux<O> zip(java.lang.Iterable<? extends org.reactivestreams.Publisher<?>> sources, int prefetch, java.util.function.Function<? super java.lang.Object[],? extends O> combinator)
Iterable.iterator()
will be called on each Publisher.subscribe(Subscriber)
.
O
- the combined produced typesources
- the Iterable
to iterate on Publisher.subscribe(Subscriber)
prefetch
- the inner source request sizecombinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
@SafeVarargs public static <I,O> Flux<O> zip(java.util.function.Function<? super java.lang.Object[],? extends O> combinator, org.reactivestreams.Publisher<? extends I>... sources)
I
- the type of the input sourcesO
- the combined produced typecombinator
- The aggregate function that will receive a unique value from each upstream and return the
value to signal downstreamsources
- the Publisher
array to iterate on Publisher.subscribe(Subscriber)
Flux
@SafeVarargs public static <I,O> Flux<O> zip(java.util.function.Function<? super java.lang.Object[],? extends O> combinator, int prefetch, org.reactivestreams.Publisher<? extends I>... sources)
I
- the type of the input sourcesO
- the combined produced typecombinator
- The aggregate function that will receive a unique value from each upstream and return the
value to signal downstreamprefetch
- individual source request sizesources
- the Publisher
array to iterate on Publisher.subscribe(Subscriber)
Flux
public static <TUPLE extends Tuple2,V> Flux<V> zip(org.reactivestreams.Publisher<? extends org.reactivestreams.Publisher<?>> sources, java.util.function.Function<? super TUPLE,? extends V> combinator)
Publisher
of Publisher
will
accumulate into a list until completion before starting zip operation. The operator will forward all combinations
of the most recent items emitted by each published source until any of them completes. Errors will immediately be
forwarded.
TUPLE
- the raw tuple typeV
- The produced output after transformation by the given combinatorsources
- The publisher of upstream Publisher
to subscribe to.combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
based on the produced valuepublic final Mono<java.lang.Boolean> all(java.util.function.Predicate<? super T> predicate)
Predicate
.
The implementation uses short-circuit logic and completes with false if the predicate doesn't match a value.
predicate
- the Predicate
to match all emitted itemsMono
of all evaluationspublic final Mono<java.lang.Boolean> any(java.util.function.Predicate<? super T> predicate)
Flux
sequence match
the predicate.
The implementation uses short-circuit logic and completes with true if the predicate matches a value.
predicate
- predicate tested upon valuesFlux
with true
if any value satisfies a predicate and false
otherwisepublic final <P> P as(java.util.function.Function<? super Flux<T>,P> transformer)
Flux
in order to generate a target type.
flux.as(Mono::from).subscribe()
P
- the returned typetransformer
- the Function
to immediately map this Flux
into a target type
instance.for a bounded conversion to {@link Publisher}
public final Flux<T> awaitOnSubscribe()
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 mentality based Subscribers.
Flux
public final T blockFirst()
public final T blockFirst(java.time.Duration d)
d
- max duration timeout to wait for.public final T blockFirstMillis(long timeout)
timeout
- max duration timeout in millis to wait for.public final T blockLast()
public final T blockLast(java.time.Duration d)
d
- max duration timeout to wait for.public final T blockLastMillis(long timeout)
timeout
- max duration timeout in millis to wait for.public final Flux<java.util.List<T>> buffer()
Flux
of at most one List
for an alternative collecting algorithm returning {@link Mono}
public final Flux<java.util.List<T>> buffer(int maxSize)
List
buckets that will be pushed into the returned Flux
when the given max size is reached or onComplete is received.
maxSize
- the maximum collected sizeFlux
of List
public final <C extends java.util.Collection<? super T>> Flux<C> buffer(int maxSize, java.util.function.Supplier<C> bufferSupplier)
Collection
buckets that will be
pushed into the returned Flux
when the given max size is reached or onComplete is received.
C
- the supplied Collection
typemaxSize
- the maximum collected sizebufferSupplier
- the collection to use for each data segmentFlux
of Collection
public final Flux<java.util.List<T>> buffer(int maxSize, int skip)
List
that will be pushed into the returned Flux
when the
given max size is reached or onComplete is received. A new container List
will be created every given
skip count.
When Skip > Max Size : dropping buffers
When Skip < Max Size : overlapping buffers
When Skip == Max Size : exact buffers
skip
- the number of items to skip before creating a new bucketmaxSize
- the max collected sizeFlux
of possibly overlapped or gapped List
public final <C extends java.util.Collection<? super T>> Flux<C> buffer(int maxSize, int skip, java.util.function.Supplier<C> bufferSupplier)
Collection
that will be pushed into
the returned Flux
when the
given max size is reached or onComplete is received. A new container
Collection
will be created every given
skip count.
When Skip > Max Size : dropping buffers
When Skip < Max Size : overlapping buffers
When Skip == Max Size : exact buffers
C
- the supplied Collection
typeskip
- the number of items to skip before creating a new bucketmaxSize
- the max collected sizebufferSupplier
- the collection to use for each data segmentFlux
of possibly overlapped or gapped
Collection
public final Flux<java.util.List<T>> buffer(org.reactivestreams.Publisher<?> other)
List
delimited by the given Publisher
signals.
other
- the other Publisher
to subscribe to for emiting and recycling receiving bucketFlux
of List
delimited by a
Publisher
public final <C extends java.util.Collection<? super T>> Flux<C> buffer(org.reactivestreams.Publisher<?> other, java.util.function.Supplier<C> bufferSupplier)
Collection
delimited by the given Publisher
signals.
C
- the supplied Collection
typeother
- the other Publisher
to subscribe to for emiting and recycling receiving bucketbufferSupplier
- the collection to use for each data segmentFlux
of Collection
delimited by a Publisher
public final <U,V> Flux<java.util.List<T>> buffer(org.reactivestreams.Publisher<U> bucketOpening, java.util.function.Function<? super U,? extends org.reactivestreams.Publisher<V>> closeSelector)
List
delimited by the given Publisher
signals. Each List
bucket will last until the mapped Publisher
receiving the boundary signal emits, thus releasing the
bucket to the returned Flux
.
When Open signal is strictly not overlapping Close signal : dropping buffers
When Open signal is strictly more frequent than Close signal : overlapping buffers
When Open signal is exactly coordinated with Close signal : exact buffers
U
- the element type of the bucket-opening sequenceV
- the element type of the bucket-closing sequencebucketOpening
- a Publisher
to subscribe to for creating new receiving bucket signals.closeSelector
- a Publisher
factory provided the opening signal and returning a Publisher
to
subscribe to for emitting relative bucket.Flux
of List
delimited by an opening Publisher
and a relative
closing Publisher
public final <U,V,C extends java.util.Collection<? super T>> Flux<C> buffer(org.reactivestreams.Publisher<U> bucketOpening, java.util.function.Function<? super U,? extends org.reactivestreams.Publisher<V>> closeSelector, java.util.function.Supplier<C> bufferSupplier)
Collection
delimited by the given Publisher
signals. Each Collection
bucket will last until the mapped Publisher
receiving the boundary signal emits, thus releasing the
bucket to the returned Flux
.
When Open signal is strictly not overlapping Close signal : dropping buffers
When Open signal is strictly more frequent than Close signal : overlapping buffers
When Open signal is exactly coordinated with Close signal : exact buffers
U
- the element type of the bucket-opening sequenceV
- the element type of the bucket-closing sequenceC
- the supplied Collection
typebucketOpening
- a Publisher
to subscribe to for creating new receiving bucket signals.closeSelector
- a Publisher
factory provided the opening signal and returning a Publisher
to
subscribe to for emitting relative bucket.bufferSupplier
- the collection to use for each data segmentFlux
of Collection
delimited by an opening Publisher
and a relative
closing Publisher
public final Flux<java.util.List<T>> buffer(java.time.Duration timespan)
List
that will be pushed into the returned Flux
every
timespan.
timespan
- the duration to use to release a buffered listFlux
of List
delimited by the given periodpublic final Flux<java.util.List<T>> buffer(java.time.Duration timespan, java.time.Duration timeshift)
List
delimited by the given timeshift
period. Each List
bucket will last until the timespan
has elapsed, thus releasing the bucket to the returned Flux
.
When timeshift > timespan : dropping buffers
When timeshift < timespan : overlapping buffers
When timeshift == timespan : exact buffers
timespan
- the duration to use to release buffered liststimeshift
- the duration to use to create a new bucketFlux
of List
delimited by the given period timeshift and sized by timespanpublic final Flux<java.util.List<T>> buffer(int maxSize, java.time.Duration timespan)
List
that will be pushed into the returned Flux
every timespan OR
maxSize items.
maxSize
- the max collected sizetimespan
- the timeout to use to release a buffered listFlux
of List
delimited by given size or a given period timeoutpublic final <C extends java.util.Collection<? super T>> Flux<C> buffer(int maxSize, java.time.Duration timespan, java.util.function.Supplier<C> bufferSupplier)
Collection
that will be pushed into the returned Flux
every timespan OR
maxSize items.
C
- the supplied Collection
typemaxSize
- the max collected sizetimespan
- the timeout to use to release a buffered listbufferSupplier
- the collection to use for each data segmentFlux
of Collection
delimited by given size or a given period timeoutpublic final Flux<java.util.List<T>> bufferMillis(long timespan)
List
that will be pushed into the returned Flux
every
timespan.
timespan
- the duration to use to release a buffered list in millisecondsFlux
of List
delimited by the given periodpublic final Flux<java.util.List<T>> bufferMillis(long timespan, TimedScheduler timer)
List
that will be pushed into the returned Flux
every
timespan.
timespan
- theduration to use to release a buffered list in millisecondstimer
- the TimedScheduler
to run onFlux
of List
delimited by the given periodpublic final Flux<java.util.List<T>> bufferMillis(long timespan, long timeshift)
List
delimited by the given timeshift
period. Each List
bucket will last until the timespan
has elapsed, thus releasing the bucket to the returned Flux
.
When timeshift > timespan : dropping buffers
When timeshift < timespan : overlapping buffers
When timeshift == timespan : exact buffers
timespan
- the duration to use to release buffered liststimeshift
- the duration to use to create a new bucketFlux
of List
delimited by the given period timeshift and sized by timespanpublic final Flux<java.util.List<T>> bufferMillis(long timespan, long timeshift, TimedScheduler timer)
List
delimited by the given timeshift
period. Each List
bucket will last until the timespan
has elapsed, thus releasing the bucket to the returned Flux
.
When timeshift > timespan : dropping buffers
When timeshift < timespan : overlapping buffers
When timeshift == timespan : exact buffers
timespan
- the duration to use to release buffered liststimeshift
- the duration to use to create a new buckettimer
- the TimedScheduler
to run onFlux
of List
delimited by the given period timeshift and sized by timespanpublic final Flux<java.util.List<T>> bufferMillis(int maxSize, long timespan)
List
that will be pushed into the returned Flux
every timespan OR
maxSize items.
maxSize
- the max collected sizetimespan
- the timeout in milliseconds to use to release a buffered listFlux
of List
delimited by given size or a given period timeoutpublic final Flux<java.util.List<T>> bufferMillis(int maxSize, long timespan, TimedScheduler timer)
List
that will be pushed into the returned Flux
every timespan OR
maxSize items
maxSize
- the max collected sizetimespan
- the timeout to use to release a buffered listtimer
- the TimedScheduler
to run onFlux
of List
delimited by given size or a given period timeoutpublic final <C extends java.util.Collection<? super T>> Flux<C> bufferMillis(int maxSize, long timespan, TimedScheduler timer, java.util.function.Supplier<C> bufferSupplier)
Collection
that will be pushed into the returned Flux
every timespan OR
maxSize items
C
- the supplied Collection
typemaxSize
- the max collected sizetimespan
- the timeout to use to release a buffered collectiontimer
- the TimedScheduler
to run onbufferSupplier
- the collection to use for each data segmentFlux
of Collection
delimited by given size or a given period timeoutpublic final Flux<T> cache()
Flux
into a hot source and cache last emitted signals for further Subscriber
. Will
retain up an unbounded volume of onNext signals. Completion and Error will also be
replayed.
Flux
public final Flux<T> cache(int history)
Flux
into a hot source and cache last emitted signals for further Subscriber
.
Will retain up to the given history size onNext signals. Completion and Error will also be
replayed.
history
- number of events retained in history excluding complete and errorFlux
public final Flux<T> cache(java.time.Duration ttl)
Flux
into a hot source and cache last emitted signals for further
Subscriber
. Will retain an unbounded history with per-item expiry timeout
Completion and Error will also be replayed.
ttl
- Time-to-live for each cached item.Flux
public final Flux<T> cache(int history, java.time.Duration ttl)
Flux
into a hot source and cache last emitted signals for further
Subscriber
. Will retain up to the given history size with per-item expiry
timeout.
history
- number of events retained in history excluding complete and errorttl
- Time-to-live for each cached item.Flux
public final <E> Flux<E> cast(java.lang.Class<E> clazz)
Flux
produced type into a target produced type.
public final <E> Mono<E> collect(java.util.function.Supplier<E> containerSupplier, java.util.function.BiConsumer<E,? super T> collector)
Flux
sequence with the given collector and supplied container on subscribe.
The collected result will be emitted when this sequence completes.
public final <R,A> Mono<R> collect(java.util.stream.Collector<T,A,R> collector)
Flux
sequence with the given collector and supplied container on subscribe.
The collected result will be emitted when this sequence completes.
public final <K> Mono<java.util.Map<K,T>> collectMap(java.util.function.Function<? super T,? extends K> keyExtractor)
Flux
sequence into a hashed map where the key is extracted by the given Function
and the
value will be the most recent emitted item for this key.
public final <K,V> Mono<java.util.Map<K,V>> collectMap(java.util.function.Function<? super T,? extends K> keyExtractor, java.util.function.Function<? super T,? extends V> valueExtractor)
Flux
sequence into a hashed map where the key is extracted by the given function and the value will be
the most recent extracted item for this key.
K
- the key extracted from each value of this Flux instanceV
- the value extracted from each value of this Flux instancekeyExtractor
- a Function
to route items into a keyed Collection
valueExtractor
- a Function
to select the data to store from each itemMono
of all last matched key-values from this Flux
public final <K,V> Mono<java.util.Map<K,V>> collectMap(java.util.function.Function<? super T,? extends K> keyExtractor, java.util.function.Function<? super T,? extends V> valueExtractor, java.util.function.Supplier<java.util.Map<K,V>> mapSupplier)
Flux
sequence into a supplied map where the key is extracted by the given function and the value will
be the most recent extracted item for this key.
K
- the key extracted from each value of this Flux instanceV
- the value extracted from each value of this Flux instancekeyExtractor
- a Function
to route items into a keyed Collection
valueExtractor
- a Function
to select the data to store from each itemmapSupplier
- a Map
factory called for each Subscriber
Mono
of all last matched key-values from this Flux
public final <K> Mono<java.util.Map<K,java.util.Collection<T>>> collectMultimap(java.util.function.Function<? super T,? extends K> keyExtractor)
Flux
sequence into a hashed map where the key is extracted by the given function and the value will be
all the emitted item for this key.
public final <K,V> Mono<java.util.Map<K,java.util.Collection<V>>> collectMultimap(java.util.function.Function<? super T,? extends K> keyExtractor, java.util.function.Function<? super T,? extends V> valueExtractor)
Flux
sequence into a hashed map where the key is extracted by the given function and the value will be
all the extracted items for this key.
K
- the key extracted from each value of this Flux instanceV
- the value extracted from each value of this Flux instancekeyExtractor
- a Function
to route items into a keyed Collection
valueExtractor
- a Function
to select the data to store from each itemMono
of all matched key-values from this Flux
public final <K,V> Mono<java.util.Map<K,java.util.Collection<V>>> collectMultimap(java.util.function.Function<? super T,? extends K> keyExtractor, java.util.function.Function<? super T,? extends V> valueExtractor, java.util.function.Supplier<java.util.Map<K,java.util.Collection<V>>> mapSupplier)
Flux
sequence into a supplied map where the key is extracted by the given function and the value will
be all the extracted items for this key.
K
- the key extracted from each value of this Flux instanceV
- the value extracted from each value of this Flux instancekeyExtractor
- a Function
to route items into a keyed Collection
valueExtractor
- a Function
to select the data to store from each itemmapSupplier
- a Map
factory called for each Subscriber
Mono
of all matched key-values from this Flux
public final Mono<java.util.List<T>> collectSortedList(java.util.Comparator<? super T> comparator)
public final <V> Flux<V> compose(java.util.function.Function<? super Flux<T>,? extends org.reactivestreams.Publisher<V>> transformer)
Flux
in order to generate a target Flux
for each
new Subscriber
.
flux.compose(Mono::from).subscribe()
V
- the item type in the returned Publisher
transformer
- the Function
to map this Flux
into a target Publisher
instance for each new subscriberFlux
for immmediate transformation of {@link Flux}
,
for a loose conversion to an arbitrary type
public final <V> Flux<V> concatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper)
flatMap(Function)
, but preserve
ordering and concatenate emissions instead of merging (no interleave).
Errors will immediately short circuit current concat backlog.
V
- the produced concatenated typemapper
- the function to transform this sequence of T into concatenated sequences of VFlux
public final <V> Flux<V> concatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper, int prefetch)
flatMap(Function)
, but preserve
ordering and concatenate emissions instead of merging (no interleave).
Errors will immediately short circuit current concat backlog.
V
- the produced concatenated typemapper
- the function to transform this sequence of T into concatenated sequences of Vprefetch
- the inner source produced demandFlux
public final <V> Flux<V> concatMapDelayError(java.util.function.Function<? super T,org.reactivestreams.Publisher<? extends V>> mapper)
flatMap(Function)
, but preserve
ordering and concatenate emissions instead of merging (no interleave).
Errors will be delayed after the current concat backlog.
V
- the produced concatenated typemapper
- the function to transform this sequence of T into concatenated sequences of VFlux
public final <V> Flux<V> concatMapDelayError(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper, int prefetch)
flatMap(Function)
, but preserve
ordering and concatenate emissions instead of merging (no interleave).
Errors will be delayed after all concated sources terminate.
V
- the produced concatenated typemapper
- the function to transform this sequence of T into concatenated sequences of Vprefetch
- the inner source produced demandFlux
public final <V> Flux<V> concatMapDelayError(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper, boolean delayUntilEnd, int prefetch)
flatMap(Function)
, but preserve
ordering and concatenate emissions instead of merging (no interleave).
Errors will be delayed after the current concat backlog if delayUntilEnd is
false or after all sources if delayUntilEnd is true.
V
- the produced concatenated typemapper
- the function to transform this sequence of T into concatenated sequences of VdelayUntilEnd
- delay error until all sources have been consumed instead of
after the current sourceprefetch
- the inner source produced demandFlux
public final <R> Flux<R> concatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
Iterable
sequences given this input sequence like flatMapIterable(Function)
, but preserve
ordering and concatenate emissions instead of merging (no interleave).
Errors will be delayed after the current concat backlog.
R
- the produced concatenated typemapper
- the function to transform this sequence of T into concatenated sequences of RFlux
public final <R> Flux<R> concatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper, int prefetch)
Iterable
sequences given this input sequence like flatMapIterable(Function)
, but preserve
ordering and concatenate emissions instead of merging (no interleave).
Errors will be delayed after the current concat backlog.
R
- the produced concatenated typemapper
- the function to transform this sequence of T into concatenated sequences of Rprefetch
- the inner source produced demandFlux
public final Mono<java.lang.Long> count()
Flux
.
The count will be emitted when onComplete is observed.
Mono
of Long
countpublic final Flux<T> defaultIfEmpty(T defaultV)
defaultV
- the alternate value if this sequence is emptyFlux
public final Flux<T> delay(java.time.Duration delay)
delay
- duration to delay each Subscriber.onNext(T)
callFlux
public final Flux<T> delayMillis(long delay)
delay
- period to delay each Subscriber.onNext(T)
call in millisecondsFlux
public final Flux<T> delayMillis(long delay, TimedScheduler timer)
delay
- period to delay each Subscriber.onNext(T)
call in millisecondstimer
- the timed scheduler to use for delaying each signalFlux
public final <U> Flux<T> delaySubscription(org.reactivestreams.Publisher<U> subscriptionDelay)
U
- the other source typesubscriptionDelay
- a
Publisher
to signal by next or complete this Publisher.subscribe(Subscriber)
Flux
public final Flux<T> delaySubscriptionMillis(long delay, TimedScheduler timer)
delay
- period in milliseconds before subscribing this Flux
timer
- the TimedScheduler
to run onFlux
public final <X> Flux<X> dematerialize()
Flux
is a emits onNext, onError or onComplete Signal
. The relative Subscriber
callback will be invoked, error Signal
will trigger onError and complete Signal
will trigger
onComplete.
X
- the dematerialized typeFlux
public final <V> Flux<T> distinct(java.util.function.Function<? super T,? extends V> keySelector)
Subscriber
, tracks this Flux
values that have been seen and
filters out duplicates given the extracted key.
V
- the type of the key extracted from each value in this sequencekeySelector
- function to compute comparison key for each elementFlux
with values having distinct keyspublic final Flux<T> distinctUntilChanged()
Flux
with conflated repeated elementspublic final <V> Flux<T> distinctUntilChanged(java.util.function.Function<? super T,? extends V> keySelector)
V
- the type of the key extracted from each value in this sequencekeySelector
- function to compute comparison key for each elementFlux
with conflated repeated elements given a comparison keypublic final Flux<T> doAfterTerminate(java.lang.Runnable afterTerminate)
Flux
terminates, either by completing downstream successfully or with an error.
afterTerminate
- the callback to call after Subscriber.onComplete()
or Subscriber.onError(java.lang.Throwable)
Flux
public final Flux<T> doOnCancel(java.lang.Runnable onCancel)
Flux
is cancelled.
onCancel
- the callback to call on Subscription.cancel()
Flux
public final Flux<T> doOnComplete(java.lang.Runnable onComplete)
Flux
completes successfully.
onComplete
- the callback to call on Subscriber.onComplete()
Flux
public final Flux<T> doOnError(java.util.function.Consumer<? super java.lang.Throwable> onError)
Flux
completes with an error.
onError
- the callback to call on Subscriber.onError(java.lang.Throwable)
Flux
public final <E extends java.lang.Throwable> Flux<T> doOnError(java.lang.Class<E> exceptionType, java.util.function.Consumer<? super E> onError)
Flux
completes with an error matching the given exception type.
E
- type of the error to handleexceptionType
- the type of exceptions to handleonError
- the error handler for each errorFlux
public final Flux<T> doOnError(java.util.function.Predicate<? super java.lang.Throwable> predicate, java.util.function.Consumer<? super java.lang.Throwable> onError)
Flux
completes with an error matching the given exception.
predicate
- the matcher for exceptions to handleonError
- the error handler for each errorFlux
public final Flux<T> doOnNext(java.util.function.Consumer<? super T> onNext)
Flux
emits an item.
onNext
- the callback to call on Subscriber.onNext(T)
Flux
public final Flux<T> doOnRequest(java.util.function.LongConsumer consumer)
consumer
- the consumer to invoke on each requestFlux
public final Flux<T> doOnSubscribe(java.util.function.Consumer<? super org.reactivestreams.Subscription> onSubscribe)
Flux
is subscribed.
onSubscribe
- the callback to call on Subscriber.onSubscribe(org.reactivestreams.Subscription)
Flux
public final Flux<T> doOnTerminate(java.lang.Runnable onTerminate)
Flux
terminates, either by completing successfully or with an error.
onTerminate
- the callback to call on Subscriber.onComplete()
or Subscriber.onError(java.lang.Throwable)
Flux
public final Flux<Tuple2<java.lang.Long,T>> elapsed()
Flux
sequence into 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 OR between two next signals.
Flux
that emits tuples of time elapsed in milliseconds and matching datapublic final Flux<Tuple2<java.lang.Long,T>> elapsed(TimedScheduler scheduler)
Flux
sequence into 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 OR
between two next signals.
scheduler
- the TimedScheduler
to read time fromFlux
that emits tuples of time elapsed in
milliseconds and matching datapublic final Mono<T> elementAt(int index)
IndexOutOfBoundsException
if the sequence is shorter.
index
- index of an itemMono
of the item at a specified indexpublic final Mono<T> elementAt(int index, T defaultValue)
index
- index of an itemdefaultValue
- supply a default value if not foundMono
of the item at a specified index or a default valuepublic final Flux<T> filter(java.util.function.Predicate<? super T> p)
Predicate
. If the predicate test succeeds, the value is
passed into the new Flux
. If the predicate test fails, the value is ignored and a request of 1 is
emitted.
p
- the Predicate
to test values againstFlux
containing only values that pass the predicate testpublic final Flux<T> firstEmittingWith(org.reactivestreams.Publisher<? extends T> other)
other
- the Publisher
to race withfirstEmitting(org.reactivestreams.Publisher<? extends I>...)
public final <R> Flux<R> flatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
Flux
into Publishers, then flatten the emissions from those by
merging them into a single Flux
, so that they may interleave.
R
- the merged output sequence typemapper
- the Function
to transform input sequence into N sequences Publisher
Flux
public final <V> Flux<V> flatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper, int concurrency)
public final <V> Flux<V> flatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper, int concurrency, int prefetch)
Flux
into Publishers, then flatten the emissions from those by
merging them into a single Flux
, so that they may interleave. The concurrency argument allows to
control how many merged Publisher
can happen in parallel. The prefetch argument allows to give an
arbitrary prefetch size to the merged Publisher
.
V
- the merged output sequence typemapper
- the Function
to transform input sequence into N sequences Publisher
concurrency
- the maximum in-flight elements from this Flux
sequenceprefetch
- the maximum in-flight elements from each inner Publisher
sequenceFlux
public final <V> Flux<V> flatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends V>> mapper, boolean delayError, int concurrency, int prefetch)
Flux
into Publishers, then flatten the emissions from those by
merging them into a single Flux
, so that they may interleave. The concurrency argument allows to
control how many merged Publisher
can happen in parallel. The prefetch argument allows to give an
arbitrary prefetch size to the merged Publisher
.
V
- the merged output sequence typemapper
- the Function
to transform input sequence into N sequences Publisher
delayError
- should any error be delayed after current merge backlogconcurrency
- the maximum in-flight elements from this Flux
sequenceprefetch
- the maximum in-flight elements from each inner Publisher
sequenceFlux
public final <R> Flux<R> flatMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapperOnNext, java.util.function.Function<java.lang.Throwable,? extends org.reactivestreams.Publisher<? extends R>> mapperOnError, java.util.function.Supplier<? extends org.reactivestreams.Publisher<? extends R>> mapperOnComplete)
Flux
into Publishers, then flatten the emissions from those by
merging them into a single Flux
, so that they may interleave.
OnError will be transformed into completion signal after its mapping callback has been applied.
R
- the output Publisher
type targetmapperOnNext
- the Function
to call on next data and returning a sequence to mergemapperOnError
- the Function
to call on error signal and returning a sequence to mergemapperOnComplete
- the Function
to call on complete signal and returning a sequence to mergeFlux
public final <R> Flux<R> flatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
Flux
into Iterable
, then flatten the elements from those by
merging them into a single Flux
. The prefetch argument allows to give an
arbitrary prefetch size to the merged Iterable
.
R
- the merged output sequence typemapper
- the Function
to transform input sequence into N sequences Iterable
Flux
public final <R> Flux<R> flatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper, int prefetch)
Flux
into Iterable
, then flatten the emissions from those by
merging them into a single Flux
. The prefetch argument allows to give an
arbitrary prefetch size to the merged Iterable
.
R
- the merged output sequence typemapper
- the Function
to transform input sequence into N sequences Iterable
prefetch
- the maximum in-flight elements from each inner Iterable
sequenceFlux
public final <R> Flux<R> flatMapSequential(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper)
Flux
into Publishers, then flatten the
emissions from those by merging them into a single Flux
, in order.
Transformed inner Publishers are subscribed to eagerly but their emitted elements
are merged respecting the order of the original sequence.
R
- the merged output sequence typemapper
- the Function
to transform input sequence into N sequences Publisher
Flux
public final <R> Flux<R> flatMapSequential(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper, int maxConcurrency)
Flux
into Publishers, then flatten the
emissions from those by merging them into a single Flux
, in order.
Transformed inner Publishers are subscribed to eagerly but their emitted elements
are merged respecting the order of the original sequence. The concurrency argument
allows to control how many merged Publisher
can happen in parallel.
public final <R> Flux<R> flatMapSequential(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper, int maxConcurrency, int prefetch)
Flux
into Publishers, then flatten the
emissions from those by merging them into a single Flux
, in order.
Transformed inner Publishers are subscribed to eagerly but their emitted elements
are merged respecting the order of the original sequence. The concurrency argument
allows to control how many merged Publisher
can happen in parallel.
The prefetch argument allows to give an arbitrary prefetch size to the merged
Publisher
.
R
- the merged output sequence typemapper
- the Function
to transform input sequence into N sequences Publisher
maxConcurrency
- the maximum in-flight elements from this Flux
sequenceprefetch
- the maximum in-flight elements from each inner Publisher
sequenceFlux
public final <R> Flux<R> flatMapSequential(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> mapper, boolean delayError, int maxConcurrency, int prefetch)
Flux
into Publishers, then flatten the
emissions from those by merging them into a single Flux
, in order.
Transformed inner Publishers are subscribed to eagerly but their emitted elements
are merged respecting the order of the original sequence. The concurrency argument
allows to control how many merged Publisher
can happen in parallel.
The prefetch argument allows to give an arbitrary prefetch size to the merged
Publisher
.
R
- the merged output sequence typemapper
- the Function
to transform input sequence into N sequences Publisher
delayError
- should any error be delayed after current merge backlogmaxConcurrency
- the maximum in-flight elements from this Flux
sequenceprefetch
- the maximum in-flight elements from each inner Publisher
sequenceFlux
public long getPrefetch()
Flux
Flux
, -1L if unspecifiedpublic final <K> Flux<GroupedFlux<K,T>> groupBy(java.util.function.Function<? super T,? extends K> keyMapper)
Flux
for each unique key evaluated by the given
key mapper.
K
- the key type extracted from each value of this sequencekeyMapper
- the key mapping Function
that evaluates an incoming data and returns a key.Flux
of GroupedFlux
grouped sequencespublic final <K,V> Flux<GroupedFlux<K,V>> groupBy(java.util.function.Function<? super T,? extends K> keyMapper, java.util.function.Function<? super T,? extends V> valueMapper)
Flux
for each unique key evaluated by the given
key mapper. It will use the given value mapper to extract the element to route.
K
- the key type extracted from each value of this sequenceV
- the value type extracted from each value of this sequencekeyMapper
- the key mapping function that evaluates an incoming data and returns a key.valueMapper
- the value mapping function that evaluates which data to extract for re-routing.Flux
of GroupedFlux
grouped sequencespublic final <TRight,TLeftEnd,TRightEnd,R> Flux<R> groupJoin(org.reactivestreams.Publisher<? extends TRight> other, java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<TLeftEnd>> leftEnd, java.util.function.Function<? super TRight,? extends org.reactivestreams.Publisher<TRightEnd>> rightEnd, java.util.function.BiFunction<? super T,? super Flux<TRight>,? extends R> resultSelector)
Flux
that correlates two Publishers when they overlap in time
and groups the results.
There are no guarantees in what order the items get combined when multiple items from one or both source Publishers overlap.
Unlike join(org.reactivestreams.Publisher<? extends TRight>, java.util.function.Function<? super T, ? extends org.reactivestreams.Publisher<TLeftEnd>>, java.util.function.Function<? super TRight, ? extends org.reactivestreams.Publisher<TRightEnd>>, java.util.function.BiFunction<? super T, ? super TRight, ? extends R>)
, items from the right Publisher will be streamed
into the right resultSelector argument Flux
.
TRight
- the type of the right PublisherTLeftEnd
- this Flux
timeout typeTRightEnd
- the right Publisher timeout typeR
- the combined result typeother
- the other Publisher to correlate items from the source Publisher withleftEnd
- a function that returns a Publisher whose emissions indicate the
duration of the values of the source PublisherrightEnd
- a function that returns a Publisher whose emissions indicate the
duration of the values of the right
PublisherresultSelector
- a function that takes an item emitted by each Publisher and returns the
value to be emitted by the resulting PublisherFlux
public final <R> Flux<R> handle(java.util.function.BiConsumer<? super T,SynchronousSink<R>> handler)
Flux
by calling a biconsumer with the
output sink for each onNext. At most one SynchronousSink.next(Object)
call must be performed and/or 0 or 1 SynchronousSink.error(Throwable)
or
SynchronousSink.complete()
.R
- the transformed typehandler
- the handling BiConsumer
Flux
public final Mono<java.lang.Boolean> hasElement(T value)
Flux
sequence match
the constant.
The implementation uses short-circuit logic and completes with true if the constant matches a value.
value
- constant compared to incoming signalsFlux
with true
if any value satisfies a predicate and false
otherwisepublic final Mono<java.lang.Boolean> hasElements()
Flux
sequence has at least one element.
The implementation uses short-circuit logic and completes with true on onNext.
Mono
with true
if any value is emitted and false
otherwisepublic final Flux<T> hide()
Flux
and its Subscription
as well.Flux
defeating any Publisher
/ Subscription
feature-detectionpublic final Mono<T> ignoreElements()
Mono
.public final <TRight,TLeftEnd,TRightEnd,R> Flux<R> join(org.reactivestreams.Publisher<? extends TRight> other, java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<TLeftEnd>> leftEnd, java.util.function.Function<? super TRight,? extends org.reactivestreams.Publisher<TRightEnd>> rightEnd, java.util.function.BiFunction<? super T,? super TRight,? extends R> resultSelector)
Flux
that correlates two Publishers when they overlap in time
and groups the results.
There are no guarantees in what order the items get combined when multiple items from one or both source Publishers overlap.
TRight
- the type of the right PublisherTLeftEnd
- this Flux
timeout typeTRightEnd
- the right Publisher timeout typeR
- the combined result typeother
- the other Publisher to correlate items from the source Publisher withleftEnd
- a function that returns a Publisher whose emissions indicate the
duration of the values of the source PublisherrightEnd
- a function that returns a Publisher whose emissions indicate the
duration of the values of the right
PublisherresultSelector
- a function that takes an item emitted by each Publisher and returns the
value to be emitted by the resulting PublisherFlux
public final Mono<T> last()
NoSuchElementException
error if the source was empty.
For a passive version use takeLast(int)
Flux
public final Mono<T> last(T defaultValue)
takeLast(int)
public final Flux<T> limitRate(int prefetchRate)
prefetchRate
when propagated upstream, effectively rate limiting
the upstream Publisher
.
Typically used for scenarios where consumer(s) request a large amount of data
(eg. Long.MAX_VALUE
) but the data source behaves better or can be optimized
with smaller requests (eg. database paging, etc...). All data is still processed.
Equivalent to flux.publishOn(Schedulers.immediate(), prefetchRate).subscribe()
prefetchRate
- the limit to apply to downstream's backpressureFlux
limiting downstream's backpressurepublishOn(Scheduler, int)
public final Flux<T> log()
Logger
support to handle trace implementation. Default will
use Level.INFO
and java.util.logging. If SLF4J is available, it will be used instead.
The default log category will be "reactor.*", a generated operator suffix will complete, e.g. "reactor.Flux.Map".
Flux
public final Flux<T> log(java.lang.String category)
Logger
support to handle trace implementation. Default will
use Level.INFO
and java.util.logging. If SLF4J is available, it will be used instead.
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".Flux
public final Flux<T> log(java.lang.String category, java.util.logging.Level level, SignalType... options)
options
and
use 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:
flux.log("category", Level.INFO, SignalType.ON_NEXT, SignalType.ON_ERROR)
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".level
- the level to enforce for this tracing Fluxoptions
- a vararg SignalType
option to filter log messagesFlux
public final Flux<T> log(java.lang.String category, java.util.logging.Level level, boolean showOperatorLine, SignalType... options)
options
and use
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:
flux.log("category", Level.INFO, SignalType.ON_NEXT, SignalType.ON_ERROR)
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".level
- the level to enforce for this tracing FluxshowOperatorLine
- capture the current stack to display operator
class/line number.options
- a vararg SignalType
option to filter log messagesFlux
public final <V> Flux<V> map(java.util.function.Function<? super T,? extends V> mapper)
Flux
by applying a function to each item.
V
- the transformed typemapper
- the transforming Function
Flux
public final Flux<T> mapError(java.util.function.Function<? super java.lang.Throwable,? extends java.lang.Throwable> mapper)
Flux
by applying a function.
mapper
- the error transforming Function
Flux
public final <E extends java.lang.Throwable> Flux<T> mapError(java.lang.Class<E> type, java.util.function.Function<? super E,? extends java.lang.Throwable> mapper)
Flux
by applying a function if the
error matches the given type, otherwise let the error flows.
E
- the error typetype
- the class of the exception type to react tomapper
- the error transforming Function
Flux
public final Flux<T> mapError(java.util.function.Predicate<? super java.lang.Throwable> predicate, java.util.function.Function<? super java.lang.Throwable,? extends java.lang.Throwable> mapper)
Flux
by applying a function if the
error matches the given predicate, otherwise let the error flows.
predicate
- the error predicatemapper
- the error transforming Function
Flux
public final Flux<Signal<T>> materialize()
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.
public final Flux<T> mergeWith(org.reactivestreams.Publisher<? extends T> other)
other
- the Publisher
to merge withFlux
public final <U> Flux<U> ofType(java.lang.Class<U> clazz)
Class
type. If the
predicate test succeeds, the value is
passed into the new Flux
. If the predicate test fails, the value is ignored and a request of 1 is
emitted.
clazz
- the Class
type to test values againstFlux
reduced to items converted to the matched typepublic final Flux<T> onBackpressureBuffer()
Flux
, or park the observed elements if not enough
demand is requested downstream. Errors will be delayed until the buffer gets consumed.
Flux
public final Flux<T> onBackpressureBuffer(int maxSize)
Flux
, or park the observed elements if not enough
demand is requested downstream. Errors will be immediately emitted on overflow
regardless of the pending buffer.
maxSize
- maximum buffer backlog size before immediate errorFlux
public final Flux<T> onBackpressureBuffer(int maxSize, java.util.function.Consumer<? super T> onOverflow)
Flux
, or park the observed elements if not enough
demand is requested downstream. Overflow error will be delayed after the current
backlog is consumed. However the Consumer
will be immediately invoked.
maxSize
- maximum buffer backlog size before overflow callback is calledonOverflow
- callback to invoke on overflowFlux
public final Flux<T> onBackpressureDrop()
Flux
, or drop the observed elements if not enough
demand is requested downstream.
Flux
public final Flux<T> onBackpressureDrop(java.util.function.Consumer<? super T> onDropped)
Flux
, or drop and notify dropping Consumer
with the observed elements if not enough demand is requested downstream.
onDropped
- the Consumer called when an value gets dropped due to lack of downstream requestsFlux
public final Flux<T> onBackpressureError()
Flux
, or emit onError fom Exceptions.failWithOverflow()
if not enough demand is requested
downstream.
Flux
on backpressurepublic final Flux<T> onBackpressureLatest()
Flux
, or only keep the most recent observed item
if not enough demand is requested downstream.
Flux
that will only keep a reference to the last observed itempublic final Flux<T> onErrorResumeWith(java.util.function.Function<? super java.lang.Throwable,? extends org.reactivestreams.Publisher<? extends T>> fallback)
fallback
- the Function
mapping the error to a new Publisher
sequenceFlux
public final <E extends java.lang.Throwable> Flux<T> onErrorResumeWith(java.lang.Class<E> type, java.util.function.Function<? super E,? extends org.reactivestreams.Publisher<? extends T>> fallback)
E
- the error typetype
- the error type to matchfallback
- the Function
mapping the error to a new Publisher
sequenceFlux
public final Flux<T> onErrorResumeWith(java.util.function.Predicate<? super java.lang.Throwable> predicate, java.util.function.Function<? super java.lang.Throwable,? extends org.reactivestreams.Publisher<? extends T>> fallback)
predicate
- the error predicate to matchfallback
- the Function
mapping the error to a new Publisher
sequenceFlux
public final Flux<T> onErrorReturn(T fallbackValue)
Flux
fallbackValue
- alternate value on fallbackFlux
public final <E extends java.lang.Throwable> Flux<T> onErrorReturn(java.lang.Class<E> type, T fallbackValue)
Flux
E
- the error typetype
- the error type to matchfallbackValue
- alternate value on fallbackFlux
public final <E extends java.lang.Throwable> Flux<T> onErrorReturn(java.util.function.Predicate<? super java.lang.Throwable> predicate, T fallbackValue)
Flux
E
- the error typepredicate
- the error predicate to matchfallbackValue
- alternate value on fallbackFlux
public final Flux<T> onTerminateDetach()
Subscriber
and the Subscription
on
termination or cancellation.
This should help with odd retention scenarios when running
with non-reactor Subscriber
.
Flux
public final ParallelFlux<T> parallel()
Flux
on number of 'rails' matching number of CPU
in round-robin fashion.
ParallelFlux
instancepublic final ParallelFlux<T> parallel(int parallelism)
Flux
on parallallism number of 'rails'
in round-robin fashion.
parallelism
- the number of parallel railsParallelFlux
instancepublic final ParallelFlux<T> parallel(int parallelism, int prefetch)
Flux
on parallallism number of 'rails'
in round-robin fashion and use custom prefetch amount and queue
for dealing with the source Flux
's values.
parallelism
- the number of parallel railsprefetch
- the number of values to prefetch from the sourceParallelFlux
instancepublic final ConnectableFlux<T> publish()
ConnectableFlux
which shares this Flux
sequence and dispatches values to
subscribers in a backpressure-aware manner. Prefetch will default to QueueSupplier.SMALL_BUFFER_SIZE
.
This will effectively turn any type of sequence into a hot sequence.
Backpressure will be coordinated on Subscription.request(long)
and if any Subscriber
is missing
demand (requested = 0), multicast will pause pushing/pulling.
ConnectableFlux
public final ConnectableFlux<T> publish(int prefetch)
ConnectableFlux
which shares this Flux
sequence and dispatches values to
subscribers in a backpressure-aware manner. This will effectively turn any type of sequence into a hot sequence.
Backpressure will be coordinated on Subscription.request(long)
and if any Subscriber
is missing
demand (requested = 0), multicast will pause pushing/pulling.
prefetch
- bounded requested demandConnectableFlux
public final <R> Flux<R> publish(java.util.function.Function<? super Flux<T>,? extends org.reactivestreams.Publisher<? extends R>> transform)
R
- the output value typetransform
- the transformation functionFlux
public final <R> Flux<R> publish(java.util.function.Function<? super Flux<T>,? extends org.reactivestreams.Publisher<? extends R>> transform, int prefetch)
R
- the output value typetransform
- the transformation functionprefetch
- the request sizeFlux
public final Mono<T> publishNext()
Mono
which shares this Flux
sequence and dispatches the first observed item to
subscribers in a backpressure-aware manner.
This will effectively turn any type of sequence into a hot sequence when the first Subscriber
subscribes.
Mono
public final Flux<T> publishOn(Scheduler scheduler)
Scheduler
Scheduler.Worker
.
Typically used for fast publisher, slow consumer(s) scenarios.
flux.publishOn(Schedulers.single()).subscribe()
scheduler
- a checked Scheduler.Worker
factoryFlux
producing asynchronouslypublic final Flux<T> publishOn(Scheduler scheduler, int prefetch)
Scheduler
Scheduler.Worker
.
Typically used for fast publisher, slow consumer(s) scenarios.
flux.publishOn(Schedulers.single()).subscribe()
scheduler
- a checked Scheduler.Worker
factoryprefetch
- the asynchronous boundary capacityFlux
producing asynchronouslypublic final Mono<T> reduce(java.util.function.BiFunction<T,T,T> aggregator)
Flux
sequence into an object of the same type than the
emitted items. The left/right BiFunction
arguments are the N-1 and N item, ignoring sequence
with 0 or 1 element only.
aggregator
- the aggregating BiFunction
Flux
public final <A> Mono<A> reduce(A initial, java.util.function.BiFunction<A,? super T,A> accumulator)
Flux
sequence into an object matching an initial value type.
The arguments are the N-1 or initial value and N current item .
A
- the type of the initial and reduced objectaccumulator
- the reducing BiFunction
initial
- the initial left argument to pass to the reducing BiFunction
Flux
public final <A> Mono<A> reduceWith(java.util.function.Supplier<A> initial, java.util.function.BiFunction<A,? super T,A> accumulator)
Flux
sequence into an object matching an initial value type.
The arguments are the N-1 or initial value and N current item .
A
- the type of the initial and reduced objectaccumulator
- the reducing BiFunction
initial
- the initial left argument supplied on subscription to the reducing BiFunction
Flux
public final Flux<T> repeat()
Flux
on onCompletepublic final Flux<T> repeat(java.util.function.BooleanSupplier predicate)
predicate
- the boolean to evaluate on onComplete.Flux
on onCompletepublic final Flux<T> repeat(long numRepeat)
numRepeat
- the number of times to re-subscribe on onCompleteFlux
on onComplete up to number of repeat specifiedpublic final Flux<T> repeat(long numRepeat, java.util.function.BooleanSupplier predicate)
numRepeat
- the number of times to re-subscribe on completepredicate
- the boolean to evaluate on onCompleteFlux
on onComplete up to number of repeat specified OR matching
predicatepublic final Flux<T> repeatWhen(java.util.function.Function<Flux<java.lang.Long>,? extends org.reactivestreams.Publisher<?>> whenFactory)
Flux
when a companion sequence signals a number of emitted elements in
response to the flux completion signal.
If the companion sequence signals when this Flux
is active, the repeat
attempt is suppressed and any terminal signal will terminate this Flux
with the same signal immediately.
public final ConnectableFlux<T> replay()
Flux
into a hot source and cache last emitted signals for further Subscriber
. Will
retain an unbounded amount of onNext signals. Completion and Error will also be
replayed.
ConnectableFlux
public final ConnectableFlux<T> replay(int history)
Flux
into a connectable hot source and cache last emitted
signals for further Subscriber
.
Will retain up to the given history size onNext signals. Completion and Error will also be
replayed.
history
- number of events retained in history excluding complete and
errorConnectableFlux
public final ConnectableFlux<T> replay(java.time.Duration ttl)
Flux
into a connectable hot source and cache last emitted signals
for further Subscriber
. Will retain each onNext up to the given per-item
expiry
timeout. Completion and Error will also be replayed.
ttl
- Per-item timeout durationConnectableFlux
public final ConnectableFlux<T> replay(int history, java.time.Duration ttl)
Flux
into a connectable hot source and cache last emitted signals
for further Subscriber
. Will retain up to the given history size onNext
signals and given a per-item ttl. Completion and Error will also be
replayed.
history
- number of events retained in history excluding complete and errorttl
- Per-item timeout durationConnectableFlux
public final ConnectableFlux<T> replayMillis(long ttl, TimedScheduler timer)
Flux
into a connectable hot source and cache last emitted signals
for further Subscriber
. Will retain up to the given history size onNext
signals. Completion and Error will also be replayed.
ttl
- Per-item timeout duration in millisecondstimer
- TimedScheduler
to read current time fromConnectableFlux
public final ConnectableFlux<T> replayMillis(int history, long ttl, TimedScheduler timer)
Flux
into a connectable hot source and cache last emitted signals
for further Subscriber
. Will retain up to the given history size onNext
signals. Completion and Error will also be replayed.
history
- number of events retained in history excluding complete and errorttl
- Per-item timeout duration in millisecondstimer
- TimedScheduler
to read current time fromConnectableFlux
public final Flux<T> retry()
Flux
sequence if it signals any error
either indefinitely.
The times == Long.MAX_VALUE is treated as infinite retry.
Flux
on onErrorpublic final Flux<T> retry(long numRetries)
Flux
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 errorFlux
on onError up to the specified number of retries.public final Flux<T> retry(java.util.function.Predicate<java.lang.Throwable> retryMatcher)
Flux
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 signalFlux
on onError if the predicates matches.public final Flux<T> retry(long numRetries, java.util.function.Predicate<java.lang.Throwable> retryMatcher)
Flux
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 errorretryMatcher
- the predicate to evaluate if retry should occur based on a given error signalFlux
on onError up to the specified number of retries and if the predicate
matches.public final Flux<T> retryWhen(java.util.function.Function<Flux<java.lang.Throwable>,? extends org.reactivestreams.Publisher<?>> whenFactory)
public final Flux<T> sample(java.time.Duration timespan)
timespan
- the duration to emit the latest observed itemFlux
by last item over a period of timepublic final <U> Flux<T> sample(org.reactivestreams.Publisher<U> sampler)
Flux
and emit its latest value whenever the sampler Publisher
signals a value.
Termination of either Publisher
will result in termination for the Subscriber
as well.
Both Publisher
will run in unbounded mode because the backpressure
would interfere with the sampling precision.
U
- the type of the sampler sequencesampler
- the sampler Publisher
Flux
by last item observed when the sampler Publisher
signalspublic final Flux<T> sampleFirst(java.time.Duration timespan)
Flux
then use the duration provided to skip other values.
timespan
- the duration to exclude others values from this sequenceFlux
by first item over a period of timepublic final <U> Flux<T> sampleFirst(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<U>> samplerFactory)
Flux
then use the duration provided by a
generated Publisher to skip other values until that sampler Publisher
signals.
U
- the companion reified typesamplerFactory
- select a Publisher
companion to signal onNext or onComplete to stop excluding
others values from this sequenceFlux
by last item observed when the sampler signalspublic final Flux<T> sampleFirstMillis(long timespan)
Flux
then use the duration provided to skip other values.
timespan
- the period in milliseconds to exclude others values from this sequenceFlux
by first item over a period of timepublic final Flux<T> sampleMillis(long timespan)
timespan
- the period in second to emit the latest observed itemFlux
by last item over a period of timepublic final <U> Flux<T> sampleTimeout(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<U>> throttlerFactory)
Flux
only if there were no new values emitted
during the time window provided by a publisher for that particular last value.
U
- the companion reified typethrottlerFactory
- select a Publisher
companion to signal onNext or onComplete to stop checking
others values from this sequence and emit the selecting itemFlux
by last single item observed before a companion Publisher
emitspublic final <U> Flux<T> sampleTimeout(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<U>> throttlerFactory, int maxConcurrency)
Flux
only if there were no newer values emitted
during the time window provided by a publisher for that particular last value.
The provided maxConcurrency will keep a bounded maximum of concurrent timeouts and drop any new items until at least one timeout terminates.
U
- the throttling typethrottlerFactory
- select a Publisher
companion to signal onNext or onComplete to stop checking
others values from this sequence and emit the selecting itemmaxConcurrency
- the maximum number of concurrent timeoutsFlux
by last single item observed before a companion Publisher
emitspublic final Flux<T> scan(java.util.function.BiFunction<T,T,T> accumulator)
Flux
values with an accumulator BiFunction
and
returns the intermediate results of this function.
Unlike scan(Object, BiFunction)
, this operator doesn't take an initial value
but treats the first Flux
value as initial value.
The accumulation works as follows:
result[0] = accumulator(source[0], source[1])
result[1] = accumulator(result[0], source[2])
result[2] = accumulator(result[1], source[3])
...
accumulator
- the accumulating BiFunction
Flux
public final <A> Flux<A> scan(A initial, java.util.function.BiFunction<A,? super T,A> accumulator)
Flux
values with the help of an accumulator BiFunction
and emits the intermediate results.
The accumulation works as follows:
result[0] = initialValue;
result[1] = accumulator(result[0], source[0])
result[2] = accumulator(result[1], source[1])
result[3] = accumulator(result[2], source[2])
...
A
- the accumulated typeinitial
- the initial argument to pass to the reduce functionaccumulator
- the accumulating BiFunction
Flux
starting with initial statepublic final <A> Flux<A> scanWith(java.util.function.Supplier<A> initial, java.util.function.BiFunction<A,? super T,A> accumulator)
Flux
values with the help of an accumulator BiFunction
and emits the intermediate results.
The accumulation works as follows:
result[0] = initialValue;
result[1] = accumulator(result[0], source[0])
result[2] = accumulator(result[1], source[1])
result[3] = accumulator(result[2], source[2])
...
A
- the accumulated typeinitial
- the initial supplier to init the first value to pass to the reduce
functionaccumulator
- the accumulating BiFunction
Flux
starting with initial statepublic final Mono<T> single()
Flux
source or signal
NoSuchElementException
(or a default generated value) for empty source,
IndexOutOfBoundsException
for a multi-item source.
Mono
with the eventual single item or an error signalpublic final Mono<T> single(T defaultValue)
Flux
source or signal
NoSuchElementException
(or a default value) for empty source,
IndexOutOfBoundsException
for a multi-item source.
public final Mono<T> singleOrEmpty()
Flux
source or
IndexOutOfBoundsException
for a multi-item source.
Mono
with the eventual single item or no itempublic final Flux<T> skip(long skipped)
Flux
.
skipped
- the number of times to dropFlux
until the specified skipped number of elementspublic final Flux<T> skip(java.time.Duration timespan)
Flux
for the given time period.
timespan
- the time window to exclude next signalsFlux
until the end of the given timespanpublic final Flux<T> skipLast(int n)
Flux
.
n
- the number of elements to ignore before completionFlux
for the specified skipped number of elements before terminationpublic final Flux<T> skipMillis(long timespan)
Flux
for the given time period.
timespan
- the time window to exclude next signalsFlux
until the end of the given timespanpublic final Flux<T> skipMillis(long timespan, TimedScheduler timer)
Flux
for the given time period.
timespan
- the time window to exclude next signalstimer
- the TimedScheduler
to run onFlux
until the end of the given timespanpublic final Flux<T> skipUntil(java.util.function.Predicate<? super T> untilPredicate)
Flux
until a Predicate
returns true for the
value. Will include the matched value.
untilPredicate
- the Predicate
evaluating to true to stop skipping.Flux
until the Predicate
matchespublic final Flux<T> skipUntilOther(org.reactivestreams.Publisher<?> other)
other
- the Publisher
companion to coordinate with to stop skippingFlux
until the other Publisher
emitspublic final Flux<T> skipWhile(java.util.function.Predicate<? super T> skipPredicate)
skipPredicate
- the Predicate
evaluating to true to keep skipping.Flux
while the Predicate
matchespublic final Flux<T> sort()
Flux
that sorts the events emitted by source Flux
.
Each item emitted by the Flux
must implement Comparable
with
respect to all
other items in the sequence.
Note that calling sort
with long, non-terminating or infinite sources
might cause OutOfMemoryError
. Use sequence splitting like
window()
to sort batches in that case.
public final Flux<T> startWith(java.lang.Iterable<? extends T> iterable)
iterable
- the sequence of values to start the sequence withFlux
with given Iterable
@SafeVarargs public final Flux<T> startWith(T... values)
Flux
sequence.
values
- the array of values to start withFlux
with given valuespublic final Flux<T> startWith(org.reactivestreams.Publisher<? extends T> publisher)
publisher
- the Publisher whose values to prependFlux
with given Publisher
sequencepublic final Cancellation subscribe()
Cancellation
task to execute to dispose and cancel the underlying Subscription
public final Cancellation subscribe(int prefetch)
prefetch
demand
prefetch
- an arbitrary valueCancellation
task to execute to dispose and cancel the underlying Subscription
public final Cancellation subscribe(java.util.function.Consumer<? super T> consumer)
Consumer
to this Flux
that will consume all the
sequence. It will request an unbounded demand.
For a passive version that observe and forward incoming data see doOnNext(java.util.function.Consumer)
consumer
- the consumer to invoke on each valueCancellation
to dispose the Subscription
public final Cancellation subscribe(java.util.function.Consumer<? super T> consumer, int prefetch)
Consumer
to this Flux
that will consume all the
sequence.
If prefetch is != Long.MAX_VALUE
, the Subscriber
will use it as
a prefetch strategy: first request N, then when 25% of N is left to be received on
onNext, request N x 0.75.
For a passive version that observe and forward incoming data see doOnNext(java.util.function.Consumer)
.
consumer
- the consumer to invoke on each valueprefetch
- the the prefetch amount, positiveCancellation
to dispose the Subscription
public final Cancellation subscribe(java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> errorConsumer)
Consumer
to this Flux
that will consume all the
sequence. It will request unbounded demand Long.MAX_VALUE
.
For a passive version that observe and forward incoming data see
doOnNext(java.util.function.Consumer)
and doOnError(java.util.function.Consumer)
.
consumer
- the consumer to invoke on each next signalerrorConsumer
- the consumer to invoke on error signalCancellation
to dispose the Subscription
public final Cancellation subscribe(java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> errorConsumer, java.lang.Runnable completeConsumer)
Consumer
to this Flux
that will consume all the
sequence. It will request unbounded demand Long.MAX_VALUE
.
For a passive version that observe and forward incoming data see doOnNext(java.util.function.Consumer)
,
doOnError(java.util.function.Consumer)
and doOnComplete(Runnable)
,
consumer
- the consumer to invoke on each valueerrorConsumer
- the consumer to invoke on error signalcompleteConsumer
- the consumer to invoke on complete signalCancellation
to dispose the Subscription
public final Cancellation subscribe(java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> errorConsumer, java.lang.Runnable completeConsumer, java.util.function.Consumer<? super org.reactivestreams.Subscription> subscriptionConsumer)
Consumer
to this Flux
that will consume all the
sequence. It will let the provided subscriptionConsumer
request the adequate amount of data, or request unbounded demand
Long.MAX_VALUE
if no such consumer is provided.
For a passive version that observe and forward incoming data see doOnNext(java.util.function.Consumer)
,
doOnError(java.util.function.Consumer)
, doOnComplete(Runnable)
and doOnSubscribe(Consumer)
.
consumer
- the consumer to invoke on each valueerrorConsumer
- the consumer to invoke on error signalcompleteConsumer
- the consumer to invoke on complete signalsubscriptionConsumer
- the consumer to invoke on subscribe signal, to be used
for the initial request
, or null for max requestCancellation
to dispose the Subscription
@Deprecated public final Cancellation subscribe(java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> errorConsumer, java.lang.Runnable completeConsumer, int prefetch)
limitRate(prefetch).subscribe(...)
to
subscribe(..., prefetch)
Consumer
to this Flux
that will consume all the sequence.
If prefetch is != Long.MAX_VALUE
, the Subscriber
will use it as
a prefetch strategy: first request N, then when 25% of N is left to be received on
onNext, request N x 0.75.
For a passive version that observe and forward
incoming data see doOnNext(java.util.function.Consumer)
, doOnError(java.util.function.Consumer)
, doOnComplete(Runnable)
and
doOnSubscribe(Consumer)
.
consumer
- the consumer to invoke on each valueerrorConsumer
- the consumer to invoke on error signalcompleteConsumer
- the consumer to invoke on complete signalprefetch
- the demand to produce to this Flux
Cancellation
to dispose the Subscription
limitRate(int)
,
subscribe(Consumer, Consumer, Runnable)
@Deprecated public final Cancellation subscribe(java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> errorConsumer, java.lang.Runnable completeConsumer, java.util.function.Consumer<? super org.reactivestreams.Subscription> subscriptionConsumer, int prefetch)
limitRate(prefetch).subscribe(...)
to
subscribe(..., prefetch)
Consumer
to this Flux
that will consume all the sequence.
If prefetch is != Long.MAX_VALUE
, the Subscriber
will use it as
a prefetch strategy: first request N, then when 25% of N is left to be received on
onNext, request N x 0.75.
For a passive version that observe and forward
incoming data see doOnNext(java.util.function.Consumer)
, doOnError(java.util.function.Consumer)
and doOnComplete(Runnable)
,
consumer
- the consumer to invoke on each valueerrorConsumer
- the consumer to invoke on error signalcompleteConsumer
- the consumer to invoke on complete signalsubscriptionConsumer
- the consumer to invoke on subscribe signal, to be used
for the initial request
, or null for max requestprefetch
- the demand to produce to this Flux
(deprecated)Cancellation
to dispose the Subscription
limitRate(int)
,
subscribe(Consumer, Consumer, Runnable, Consumer)
public final Flux<T> subscribeOn(Scheduler scheduler)
Scheduler
Typically used for slow publisher e.g., blocking IO, fast consumer(s) scenarios.
flux.subscribeOn(Schedulers.single()).subscribe()
scheduler
- a checked Scheduler.Worker
factoryFlux
requesting asynchronouslypublic final <E extends org.reactivestreams.Subscriber<? super T>> E subscribeWith(E subscriber)
Publisher.subscribe(Subscriber)
alternative to inline composition type conversion to a hot
emitter (e.g. FluxProcessor
or MonoProcessor
).
flux.subscribeWith(WorkQueueProcessor.create()).subscribe()
E
- the reified type from the input/output subscribersubscriber
- the Subscriber
to subscribe and returnSubscriber
public final Flux<T> switchIfEmpty(org.reactivestreams.Publisher<? extends T> alternate)
alternate
- the alternate publisher if this sequence is emptyFlux
on source onComplete without elementspublic final <V> Flux<V> switchMap(java.util.function.Function<? super T,org.reactivestreams.Publisher<? extends V>> fn)
V
- the type of the return value of the transformation functionfn
- the transformation functionFlux
on source onNextpublic final <V> Flux<V> switchMap(java.util.function.Function<? super T,org.reactivestreams.Publisher<? extends V>> fn, int prefetch)
V
- the type of the return value of the transformation functionfn
- the transformation functionprefetch
- the produced demand for inner sourcesFlux
on source onNextpublic final <E extends java.lang.Throwable> Flux<T> switchOnError(java.lang.Class<E> type, org.reactivestreams.Publisher<? extends T> fallback)
Publisher
if an error matching the given
type is observed on this Flux
E
- the error typetype
- the error type to match to fallbackfallback
- the alternate Publisher
Flux
on source onErrorpublic final Flux<T> switchOnError(java.util.function.Predicate<? super java.lang.Throwable> predicate, org.reactivestreams.Publisher<? extends T> fallback)
Publisher
if an error matching the given
predicate is observed on this Flux
predicate
- the predicate to match an errorfallback
- the alternate Publisher
Flux
on source onErrorpublic final Flux<T> switchOnError(org.reactivestreams.Publisher<? extends T> fallback)
fallback
- the alternate Publisher
Flux
on source onErrorpublic final Flux<T> takeLast(int n)
Flux
emitted before its completion.
public final Flux<T> takeMillis(long timespan, TimedScheduler timer)
Flux
until the given time period elapses.
If the time period is zero, the Subscriber
gets completed if this Flux
completes, signals an
error or
signals its first value (which is not not relayed though).
timespan
- the time window of items to emit from this Flux
timer
- the TimedScheduler
to run onFlux
public final Flux<T> takeUntil(java.util.function.Predicate<? super T> predicate)
Flux
until the given Predicate
matches.
Unlike takeWhile(java.util.function.Predicate<? super T>)
, this will include the matched data.
public final Flux<T> takeWhile(java.util.function.Predicate<? super T> continuePredicate)
takeUntilOther(org.reactivestreams.Publisher<?>)
, this will exclude the matched data.
continuePredicate
- the Predicate
invoked each onNext returning FALSE to terminateFlux
public final Mono<java.lang.Void> then()
Mono<Void>
that completes when this Flux
completes.
This will actively ignore the sequence and only replay completion or error signals.
Mono
@Deprecated public final Mono<java.lang.Void> then(org.reactivestreams.Publisher<java.lang.Void> other)
thenEmpty(Publisher)
instead, this alias will be
removed in 3.1.0Mono<Void>
that waits for this Flux
to complete then
for a supplied Publisher<Void>
to also complete. The
second completion signal is replayed, or any error signal that occurs instead.
other
- a Publisher
to wait for after this Flux's terminationMono
completing when both publishers have completed in
sequencepublic final Mono<java.lang.Void> thenEmpty(org.reactivestreams.Publisher<java.lang.Void> other)
Mono<Void>
that waits for this Flux
to complete then
for a supplied Publisher<Void>
to also complete. The
second completion signal is replayed, or any error signal that occurs instead.
other
- a Publisher
to wait for after this Flux's terminationMono
completing when both publishers have completed in
sequencepublic final Mono<java.lang.Void> then(java.util.function.Supplier<? extends org.reactivestreams.Publisher<java.lang.Void>> afterSupplier)
Flux
that emits the completion signal of the supplied
Publisher
when this Flux
onComplete or onError. If an error occur,
the error signal is replayed after the supplied Publisher
is terminated.
afterSupplier
- a Supplier
of Publisher
to wait for after
this Flux terminationFlux
emitting eventually from the supplied Publisher
public final <V> Flux<V> thenMany(org.reactivestreams.Publisher<V> other)
Flux
that emits the sequence of the supplied Publisher
after this Flux
completes, ignoring this flux elements. If an error
occurs it immediately terminates the resulting flux.
V
- the supplied produced typeother
- a Publisher
to emit from after terminationFlux
emitting eventually from the supplied Publisher
public final <V> Flux<V> thenMany(java.util.function.Supplier<? extends org.reactivestreams.Publisher<V>> afterSupplier)
Flux
that emits the sequence of the supplied Publisher
after this Flux
completes, ignoring this flux elements. If an error occurs
it immediately terminates the resulting flux.
V
- the supplied produced typeafterSupplier
- a Supplier
of Publisher
to emit from after terminationFlux
emitting eventually from the supplied Publisher
public final Flux<T> timeout(java.time.Duration timeout)
TimeoutException
in case a per-item period fires before the
next item arrives from this Flux
.
public final Flux<T> timeout(java.time.Duration timeout, org.reactivestreams.Publisher<? extends T> fallback)
Publisher
in case a per-item period
fires before the next item arrives from this Flux
.
If the given Publisher
is null, signal a TimeoutException
.
public final <U> Flux<T> timeout(org.reactivestreams.Publisher<U> firstTimeout)
TimeoutException
in case a first item from this Flux
has
not been emitted before the given Publisher
emits.
public final <U,V> Flux<T> timeout(org.reactivestreams.Publisher<U> firstTimeout, java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<V>> nextTimeoutFactory)
TimeoutException
in case a first item from this Flux
has
not been emitted before the given Publisher
emits. The following items will be individually timed via
the factory provided Publisher
.
U
- the type of the elements of the first timeout PublisherV
- the type of the elements of the subsequent timeout PublishersfirstTimeout
- the timeout Publisher
that must not emit before the first signal from this Flux
nextTimeoutFactory
- the timeout Publisher
factory for each next itemFlux
public final <U,V> Flux<T> timeout(org.reactivestreams.Publisher<U> firstTimeout, java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<V>> nextTimeoutFactory, org.reactivestreams.Publisher<? extends T> fallback)
Publisher
in case a first item from this Flux
has
not been emitted before the given Publisher
emits. The following items will be individually timed via
the factory provided Publisher
.
U
- the type of the elements of the first timeout PublisherV
- the type of the elements of the subsequent timeout PublishersfirstTimeout
- the timeout Publisher
that must not emit before the first signal from this Flux
nextTimeoutFactory
- the timeout Publisher
factory for each next itemfallback
- the fallback Publisher
to subscribe when a timeout occursFlux
with a fallback Publisher
public final Flux<T> timeoutMillis(long timeout)
TimeoutException
error in case a per-item period in milliseconds fires
before the next item arrives from this Flux
.
public final Flux<T> timeoutMillis(long timeout, TimedScheduler timer)
TimeoutException
error in case a per-item period in milliseconds fires
before the next item arrives from this Flux
.
timeout
- the timeout in milliseconds between two signals from this Flux
timer
- the TimedScheduler
to run onFlux
public final Flux<T> timeoutMillis(long timeout, org.reactivestreams.Publisher<? extends T> fallback)
Publisher
in case a per-item period
fires before the next item arrives from this Flux
.
If the given Publisher
is null, signal a TimeoutException
.
public final Flux<T> timeoutMillis(long timeout, org.reactivestreams.Publisher<? extends T> fallback, TimedScheduler timer)
Publisher
in case a per-item period
fires before the next item arrives from this Flux
.
If the given Publisher
is null, signal a TimeoutException
.
timeout
- the timeout between two signals from this Flux
in millisecondsfallback
- the fallback Publisher
to subscribe when a timeout occurstimer
- the TimedScheduler
to run onFlux
with a fallback Publisher
public final Flux<Tuple2<java.lang.Long,T>> timestamp()
Tuple2
pair of T1 Long
current system time in
millis and T2 T
associated data for each item from this Flux
Flux
public final Flux<Tuple2<java.lang.Long,T>> timestamp(TimedScheduler scheduler)
Tuple2
pair of T1 Long
current system time in
millis and T2 T
associated data for each item from this Flux
scheduler
- the TimedScheduler
to read time fromFlux
public final java.lang.Iterable<T> toIterable()
Iterable
public final java.lang.Iterable<T> toIterable(long batchSize)
Flux
into a lazy Iterable
blocking on next calls.batchSize
- the bounded capacity to produce to this Flux
or Integer.MAX_VALUE
for unbounded
Iterable
public final java.lang.Iterable<T> toIterable(long batchSize, java.util.function.Supplier<java.util.Queue<T>> queueProvider)
batchSize
- the bounded capacity to produce to this Flux
or Integer.MAX_VALUE
for unboundedqueueProvider
- the supplier of the queue implementation to be used for transferring elements
across threads.Iterable
public java.util.stream.Stream<T> toStream()
Stream
of unknown size with onClose attached to Subscription.cancel()
public java.util.stream.Stream<T> toStream(int batchSize)
Flux
into a lazy Stream
blocking on next calls.batchSize
- the bounded capacity to produce to this Flux
or Integer.MAX_VALUE
for unbounded
Stream
of unknown size with onClose attached to Subscription.cancel()
public final <V> Flux<V> transform(java.util.function.Function<? super Flux<T>,? extends org.reactivestreams.Publisher<V>> transformer)
Flux
in order to generate a target Flux
. Unlike compose(Function)
, the
provided function is executed as part of assembly.
Function<Flux, Flux> applySchedulers = flux -> flux.subscribeOn(Schedulers.elastic()).publishOn(Schedulers.parallel());
flux.transform(applySchedulers).map(v -> v * v).subscribe()
V
- the item type in the returned Flux
transformer
- the Function
to immediately map this Flux
into a target Flux
instance.Flux
for deferred composition of {@link Flux} for each {@link Subscriber}
,
for a loose conversion to an arbitrary type
public final Flux<Flux<T>> window(org.reactivestreams.Publisher<?> boundary)
Flux
sequence into continuous, non-overlapping windows
where the window boundary is signalled by another Publisher
boundary
- a Publisher
to emit any item for a split signal and complete to terminateFlux
delimiting its sub-sequences by a given Publisher
public final <U,V> Flux<Flux<T>> window(org.reactivestreams.Publisher<U> bucketOpening, java.util.function.Function<? super U,? extends org.reactivestreams.Publisher<V>> closeSelector)
Flux
sequence into potentially overlapping windows controlled by items of a
start Publisher
and end Publisher
derived from the start values.
When Open signal is strictly not overlapping Close signal : dropping windows
When Open signal is strictly more frequent than Close signal : overlapping windows
When Open signal is exactly coordinated with Close signal : exact windows
U
- the type of the sequence opening windowsV
- the type of the sequence closing windows opened by the bucketOpening Publisher's elementsbucketOpening
- a Publisher
to emit any item for a split signal and complete to terminatecloseSelector
- a Function
given an opening signal and returning a Publisher
that
emits to complete the windowFlux
delimiting its sub-sequences by a given Publisher
and lasting until
a selected Publisher
emitspublic final Flux<Flux<T>> window(java.time.Duration timespan)
Flux
sequence into continuous, non-overlapping windows delimited by a given period.
public final Flux<Flux<T>> window(java.time.Duration timespan, java.time.Duration timeshift)
Flux
sequence into multiple Flux
delimited by the given timeshift
period, starting from the first item.
Each Flux
bucket will onComplete after timespan
period has elpased.
When timeshift > timespan : dropping windows
When timeshift < timespan : overlapping windows
When timeshift == timespan : exact windows
public final Flux<Flux<T>> windowMillis(long timespan)
Flux
sequence into continuous, non-overlapping windows delimited by a given period.
public final Flux<Flux<T>> windowMillis(long timespan, TimedScheduler timer)
Flux
sequence into continuous, non-overlapping windows delimited by a given period.
timespan
- the duration in milliseconds to delimit Flux
windowstimer
- the TimedScheduler
to run onFlux
of timed Flux
bucketspublic final Flux<Flux<T>> windowMillis(long timespan, long timeshift, TimedScheduler timer)
Flux
sequence into multiple Flux
delimited by the given timeshift
period, starting from the first item.
Each Flux
bucket will onComplete after timespan
period has elpased.
When timeshift > timespan : dropping windows
When timeshift < timespan : overlapping windows
When timeshift == timespan : exact windows
timespan
- the maximum Flux
window duration in millisecondstimeshift
- the period of time in milliseconds to create new Flux
windowstimer
- the TimedScheduler
to run onFlux
of Flux
buckets delimited by an opening Publisher
and a selected closing Publisher
public final Flux<Flux<T>> windowMillis(int maxSize, long timespan, TimedScheduler timer)
Flux
sequence into multiple Flux
delimited by the given maxSize
number
of items, starting from the first item. Flux
windows will onComplete after a given
timespan occurs and the number of items has not be counted.
maxSize
- the maximum Flux
window items to count before onCompletetimespan
- the timeout to use to onComplete a given window if size is not counted yettimer
- the TimedScheduler
to run onFlux
of sized or timed Flux
bucketspublic final <U,R> Flux<R> withLatestFrom(org.reactivestreams.Publisher<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> resultSelector)
Flux
with values from another
Publisher
through a BiFunction
and emits the result.
The operator will drop values from this Flux
until the other
Publisher
produces any value.
If the other Publisher
completes without any value, the sequence is completed.
U
- the other Publisher
sequence typeR
- the result typeother
- the Publisher
to combine withresultSelector
- the bi-function called with each pair of source and other elements that should return a single value to be emittedFlux
gated by another Publisher
public final <T2> Flux<Tuple2<T,T2>> zipWith(org.reactivestreams.Publisher<? extends T2> source2)
T2
- type of the value from source2source2
- The second upstream Publisher
to subscribe to.Flux
public final <T2,V> Flux<V> zipWith(org.reactivestreams.Publisher<? extends T2> source2, java.util.function.BiFunction<? super T,? super T2,? extends V> combinator)
T2
- type of the value from source2V
- The produced output after transformation by the combinatorsource2
- The second upstream Publisher
to subscribe to.combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
public final <T2,V> Flux<V> zipWith(org.reactivestreams.Publisher<? extends T2> source2, int prefetch, java.util.function.BiFunction<? super T,? super T2,? extends V> combinator)
T2
- type of the value from source2V
- The produced output after transformation by the combinatorsource2
- The second upstream Publisher
to subscribe to.prefetch
- the request size to use for this Flux
and the other Publisher
combinator
- The aggregate function that will receive a unique value from each upstream and return the value
to signal downstreamFlux
public final <T2> Flux<Tuple2<T,T2>> zipWith(org.reactivestreams.Publisher<? extends T2> source2, int prefetch)
public final <T2> Flux<Tuple2<T,T2>> zipWithIterable(java.lang.Iterable<? extends T2> iterable)
T2
- the value type of the other iterable sequenceiterable
- the Iterable
to pair with
Flux
public final <T2,V> Flux<V> zipWithIterable(java.lang.Iterable<? extends T2> iterable, java.util.function.BiFunction<? super T,? super T2,? extends V> zipper)
T2
- the value type of the other iterable sequenceV
- the result typeiterable
- the Iterable
to pair withzipper
- the BiFunction
combinatorFlux
protected static <T> Flux<T> onAssembly(Flux<T> source)
T
- the value typesource
- the source to wrapprotected static <T> ConnectableFlux<T> onAssembly(ConnectableFlux<T> source)
T
- the value typesource
- the source to wrappublic java.lang.String toString()
toString
in class java.lang.Object