public class MultiSubscribe<T> extends Object
| Constructor and Description |
|---|
MultiSubscribe(AbstractMulti<T> upstream) |
| Modifier and Type | Method and Description |
|---|---|
BlockingIterable<T> |
asIterable() |
BlockingIterable<T> |
asIterable(int batchSize,
Supplier<Queue<T>> supplier)
Consumes the upstream
Multi as an iterable. |
Stream<T> |
asStream() |
Stream<T> |
asStream(int batchSize,
Supplier<Queue<T>> supplier)
Consumes the items from the upstream
Multi as a blocking stream. |
Cancellable |
with(Consumer<? super org.reactivestreams.Subscription> onSubscription,
Consumer<? super T> onItem,
Consumer<? super Throwable> onFailure,
Runnable onComplete)
Subscribes to the
Multi to start receiving the items. |
Cancellable |
with(Consumer<? super T> onItem)
Subscribes to the
Multi to start receiving the items. |
Cancellable |
with(Consumer<? super T> onItem,
Consumer<? super Throwable> onFailure)
Subscribes to the
Multi to start receiving the items. |
Cancellable |
with(Consumer<? super T> onItem,
Consumer<? super Throwable> onFailure,
Runnable onComplete)
Subscribes to the
Multi to start receiving the items. |
Cancellable |
with(Consumer<? super T> onItem,
Runnable onComplete)
Subscribes to the
Multi to start receiving the items. |
<S extends MultiSubscriber<? super T>> |
withSubscriber(S subscriber)
Subscribes to the
Multi to get a subscription and then start receiving items (
based on the passed requests). |
<S extends org.reactivestreams.Subscriber<? super T>> |
withSubscriber(S subscriber)
Subscribes to the
Multi to get a subscription and then start receiving items (
based on the passed requests). |
public MultiSubscribe(AbstractMulti<T> upstream)
public <S extends org.reactivestreams.Subscriber<? super T>> S withSubscriber(S subscriber)
Multi to get a subscription and then start receiving items (
based on the passed requests).
This is a "factory method" and can be called multiple times, each time starting a new Subscription.
Each Subscription will work for only a single Subscriber. A Subscriber should
only subscribe once to a single Multi.
If the Multi rejects the subscription attempt or otherwise fails it will fire a failure event
receiving by Subscriber.onError(Throwable).
S - the subscriber typesubscriber - the subscriber, must not be nullpublic <S extends MultiSubscriber<? super T>> S withSubscriber(S subscriber)
Multi to get a subscription and then start receiving items (
based on the passed requests).
This is a "factory method" and can be called multiple times, each time starting a new Subscription.
Each Subscription will work for only a single MultiSubscriber. A MultiSubscriber should
only subscribe once to a single Multi.
If the Multi rejects the subscription attempt or otherwise fails it will fire a failure event
receiving by MultiSubscriber.onFailure(Throwable).
S - the subscriber typesubscriber - the subscriber, must not be nullpublic Cancellable with(Consumer<? super org.reactivestreams.Subscription> onSubscription, Consumer<? super T> onItem, Consumer<? super Throwable> onFailure, Runnable onComplete)
Multi to start receiving the items.
This method accepts the following callbacks:
onSubscription receives the Subscription, you must request items using
the Subscription.request(long) methodonItem receives the requested items if anyonFailure receives the failure if anyonComplete receives the completion event
This method returns a Cancellable to cancel the subscription.
This is a "factory method" and can be called multiple times, each time starting a new Subscription.
Each Subscription will work for only a single Subscriber. A Subscriber should
only subscribe once to a single Multi.
onSubscription - the callback receiving the subscription, must not be nullonItem - the callback receiving the items, must not be nullonFailure - the callback receiving the failure, must not be nullonComplete - the callback receiving the completion event, must not be nullpublic Cancellable with(Consumer<? super T> onItem, Consumer<? super Throwable> onFailure, Runnable onComplete)
Multi to start receiving the items.
This method accepts the following callbacks:
onItem receives the requested items if anyonFailure receives the failure if anyonComplete receives the completion event
This method returns a Cancellable to cancel the subscription.
Important: This method request Long.MAX_VALUE items.
This is a "factory method" and can be called multiple times, each time starting a new Subscription.
Each Subscription will work for only a single Subscriber. A Subscriber should
only subscribe once to a single Multi.
onItem - the callback receiving the items, must not be nullonFailure - the callback receiving the failure, must not be nullonComplete - the callback receiving the completion event, must not be nullpublic Cancellable with(Consumer<? super T> onItem, Consumer<? super Throwable> onFailure)
Multi to start receiving the items.
This method accepts the following callbacks:
onItem receives the requested items if anyonFailure receives the failure if anySo, you won't be notified on stream completion.
This method returns a Cancellable to cancel the subscription.
Important: This method request Long.MAX_VALUE items.
This is a "factory method" and can be called multiple times, each time starting a new Subscription.
Each Subscription will work for only a single Subscriber. A Subscriber should
only subscribe once to a single Multi.
*
onItem - the callback receiving the items, must not be nullonFailure - the callback receiving the failure, must not be nullpublic Cancellable with(Consumer<? super T> onItem)
Multi to start receiving the items.
This method receives only the onItem callback, invoked on each item.
So, you won't be notified on stream completion, and on failure the default failure handler is used.
This method returns a Cancellable to cancel the subscription.
Important: This method request Long.MAX_VALUE items.
This is a "factory method" and can be called multiple times, each time starting a new Subscription.
Each Subscription will work for only a single Subscriber. A Subscriber should
only subscribe once to a single Multi.
*
onItem - the callback receiving the items, must not be nullpublic Cancellable with(Consumer<? super T> onItem, Runnable onComplete)
Multi to start receiving the items.
This method accepts the following callbacks:
onItem receives the requested items if anyonComplete receives the completion event
So, you won't be notified on failure.
This method returns a Cancellable to cancel the subscription.
Important: This method request Long.MAX_VALUE items.
This is a "factory method" and can be called multiple times, each time starting a new Subscription.
Each Subscription will work for only a single Subscriber. A Subscriber should
only subscribe once to a single Multi.
onItem - the callback receiving the items, must not be nullonComplete - the callback receiving the completion event, must not be nullpublic BlockingIterable<T> asIterable()
Multi.public BlockingIterable<T> asIterable(int batchSize, Supplier<Queue<T>> supplier)
Multi as an iterable.batchSize - the number of elements stored in the queuesupplier - the supplier of queue used internally, must not be null, must not return nullMulti.public Stream<T> asStream()
Multi.public Stream<T> asStream(int batchSize, Supplier<Queue<T>> supplier)
Multi as a blocking stream.batchSize - the number of element stored in the queuesupplier - the supplier of queue used internally, must not be null, must not return nullMultiCopyright © 2019–2020 SmallRye. All rights reserved.