Class ConcatPublisher<T>
java.lang.Object
io.helidon.common.reactive.ConcatPublisher<T>
- Type Parameters:
T- item type
- All Implemented Interfaces:
Multi<T>, Subscribable<T>, Flow.Publisher<T>
Concat streams to one.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ConcatPublisher<T> create(Flow.Publisher<T> firstPublisher, Flow.Publisher<T> secondPublisher) Create newConcatPublisher.voidsubscribe(Flow.Subscriber<? super T> subscriber) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Multi
collect, collect, collectList, collectStream, compose, defaultIfEmpty, defaultIfEmpty, distinct, dropWhile, filter, first, flatMap, flatMap, flatMapCompletionStage, flatMapIterable, flatMapIterable, flatMapOptional, forEach, forEachCompletionStage, ifEmpty, ignoreElements, limit, log, log, log, log, map, observeOn, observeOn, onCancel, onComplete, onCompleteResume, onCompleteResumeWith, onError, onErrorResume, onErrorResumeWith, onTerminate, peek, reduce, reduce, retry, retry, retryWhen, skip, switchIfEmpty, takeUntil, takeWhile, timeout, timeout, toModifier and TypeMethodDescriptiondefault <U> Single<U> default <U> Single<U> collect(Supplier<? extends U> collectionSupplier, BiConsumer<U, T> accumulator) default <A,R> Single <R> collectStream(Collector<T, A, R> collector) Collects up upstream items with the help of a the callbacks of aCollector.default <U> Multi<U> compose(Function<? super Multi<T>, ? extends Flow.Publisher<? extends U>> composer) Apply the givencomposerfunction to the currentMultiinstance and return aMultiwrapping the returnedFlow.Publisherof this function.defaultIfEmpty(Supplier<? extends T> supplier) Signals the default item supplied by specified supplier if the upstream is empty.defaultIfEmpty(T defaultItem) Signals the default item if the upstream is empty.distinct()Filter out all duplicates.Drop the longest prefix of elements from this stream that satisfy the given predicate.Filter stream items with provided predicate.first()default <U> Multi<U> flatMap(Function<? super T, ? extends Flow.Publisher<? extends U>> publisherMapper) Transform item with supplied function and flatten resultingFlow.Publisherto downstream.default <U> Multi<U> flatMap(Function<? super T, ? extends Flow.Publisher<? extends U>> mapper, long maxConcurrency, boolean delayErrors, long prefetch) Transform item with supplied function and flatten resultingFlow.Publisherto downstream while limiting the maximum number of concurrent innerFlow.Publishers and their in-flight item count, optionally aggregating and delaying all errors until all sources terminate.default <U> Multi<U> flatMapCompletionStage(Function<? super T, ? extends CompletionStage<? extends U>> mapper) Transform item with supplied function and flatten resultingCompletionStageresults to downstream.default <U> Multi<U> flatMapIterable(Function<? super T, ? extends Iterable<? extends U>> iterableMapper) Transform item with supplied function and flatten resultingIterableto downstream.default <U> Multi<U> flatMapIterable(Function<? super T, ? extends Iterable<? extends U>> iterableMapper, int prefetch) Transform item with supplied function and flatten resultingIterableto downstream.default <U> Multi<U> flatMapOptional(Function<? super T, Optional<? extends U>> mapper) Transform item with supplied function and flatten resultingOptionalto downstream as one item if present or nothing if empty.Terminal stage, invokes provided consumer for every item in the stream with no backpressure.forEachCompletionStage(Function<? super T, CompletionStage<Void>> function) Terminal stage, invokes provided consumer for every item in the stream with strict backpressure.Executes givenRunnablewhen stream is finished without value(empty stream).Terminal stage, ignore all items and complete returnedSingle<Void>successfully or exceptionally.limit(long limit) Limit stream to allow only specified number of items to pass.log()Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.default <U> Multi<U> Re-emit the upstream's signals to the downstream on the given executor's thread using a default buffer size of 32 and errors skipping ahead of items.Re-emit the upstream's signals to the downstream on the given executor's thread.Executes givenRunnablewhen a cancel signal is received.onComplete(Runnable onComplete) Executes givenRunnablewhen onComplete signal is received.onCompleteResume(T item) Resume stream from single item if onComplete signal is intercepted.onCompleteResumeWith(Flow.Publisher<? extends T> publisher) Resume stream from supplied publisher if onComplete signal is intercepted.Executes givenRunnablewhen onError signal is received.onErrorResume(Function<? super Throwable, ? extends T> onError) Functionproviding one item to be submitted as onNext in case of onError signal is received.onErrorResumeWith(Function<? super Throwable, ? extends Flow.Publisher<? extends T>> onError) Resume stream from supplied publisher if onError signal is intercepted.onTerminate(Runnable onTerminate) Executes givenRunnablewhen any of signals onComplete, onCancel or onError is received.Invoke provided consumer for every item in stream.reduce(BiFunction<T, T, T> reducer) Combine subsequent items via a callback function and emit the final value result as a Single.default <R> Single<R> reduce(Supplier<? extends R> supplier, BiFunction<R, T, R> reducer) Combine every upstream item with an accumulator value to produce a new accumulator value and emit the final accumulator value as a Single.retry(long count) Retry a failing upstream at most the given number of times before giving up.retry(BiPredicate<? super Throwable, ? super Long> predicate) Retry a failing upstream if the predicate returns true.retryWhen(BiFunction<? super Throwable, ? super Long, ? extends Flow.Publisher<U>> whenFunction) Retry a failing upstream when the given function returns a publisher that signals an item.skip(long skip) Skip first n items, all the others are emitted.switchIfEmpty(Flow.Publisher<T> other) Switch to the other publisher if the upstream is empty.takeUntil(Flow.Publisher<U> other) Relay upstream items until the other source signals an item or completes.Take the longest prefix of elements from this stream that satisfy the given predicate.timeout(long timeout, TimeUnit unit, ScheduledExecutorService executor) Signals aTimeoutExceptionif the upstream doesn't signal the next item, error or completion within the specified time.timeout(long timeout, TimeUnit unit, ScheduledExecutorService executor, Flow.Publisher<T> fallback) Switches to a fallback single if the upstream doesn't signal the next item, error or completion within the specified time.default <U> UApply the givenconverterfunction to the currentMultiinstance and return the value returned by this function.Methods inherited from interface Subscribable
subscribe, subscribe, subscribe, subscribeModifier and TypeMethodDescriptiondefault voidSubscribe to thisSingleinstance with the given delegate functions.default voidSubscribe to thisSingleinstance with the given delegate functions.default voidsubscribe(Consumer<? super T> consumer, Consumer<? super Throwable> errorConsumer, Runnable completeConsumer) Subscribe to thisSingleinstance with the given delegate functions.default voidsubscribe(Consumer<? super T> consumer, Consumer<? super Throwable> errorConsumer, Runnable completeConsumer, Consumer<? super Flow.Subscription> subscriptionConsumer) Subscribe to thisSingleinstance with the given delegate functions.
-
Method Details
-
create
public static <T> ConcatPublisher<T> create(Flow.Publisher<T> firstPublisher, Flow.Publisher<T> secondPublisher) Create newConcatPublisher.- Type Parameters:
T- item type- Parameters:
firstPublisher- first streamsecondPublisher- second stream- Returns:
ConcatPublisher
-
subscribe
- Specified by:
subscribein interfaceFlow.Publisher<T>
-