Class MultiSubscribe<T>
- java.lang.Object
-
- io.smallrye.mutiny.groups.MultiSubscribe<T>
-
public class MultiSubscribe<T> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description MultiSubscribe(AbstractMulti<T> upstream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.smallrye.mutiny.helpers.BlockingIterable<T>asIterable()io.smallrye.mutiny.helpers.BlockingIterable<T>asIterable(int batchSize, java.util.function.Supplier<java.util.Queue<T>> supplier)Consumes the upstreamMultias an iterable.io.smallrye.mutiny.helpers.BlockingIterable<T>asIterable(java.util.function.Supplier<Context> contextSupplier)io.smallrye.mutiny.helpers.BlockingIterable<T>asIterable(java.util.function.Supplier<Context> contextSupplier, int batchSize, java.util.function.Supplier<java.util.Queue<T>> queueSupplier)Consumes the upstreamMultias an iterable.java.util.stream.Stream<T>asStream()java.util.stream.Stream<T>asStream(int batchSize, java.util.function.Supplier<java.util.Queue<T>> supplier)Consumes the items from the upstreamMultias a blocking stream.java.util.stream.Stream<T>asStream(java.util.function.Supplier<Context> contextSupplier)java.util.stream.Stream<T>asStream(java.util.function.Supplier<Context> contextSupplier, int batchSize, java.util.function.Supplier<java.util.Queue<T>> queueSupplier)Consumes the items from the upstreamMultias a blocking stream.Cancellablewith(Context context, java.util.function.Consumer<? super org.reactivestreams.Subscription> onSubscription, java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure, java.lang.Runnable onComplete)Subscribes to theMultito start receiving the items.Cancellablewith(Context context, java.util.function.Consumer<? super T> onItem)Subscribes to theMultito start receiving the items.Cancellablewith(Context context, java.util.function.Consumer<? super T> onItem, java.lang.Runnable onComplete)Subscribes to theMultito start receiving the items.Cancellablewith(Context context, java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure)Subscribes to theMultito start receiving the items.Cancellablewith(Context context, java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure, java.lang.Runnable onComplete)Subscribes to theMultito start receiving the items.Cancellablewith(java.util.function.Consumer<? super org.reactivestreams.Subscription> onSubscription, java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure, java.lang.Runnable onComplete)Subscribes to theMultito start receiving the items.Cancellablewith(java.util.function.Consumer<? super T> onItem)Subscribes to theMultito start receiving the items.Cancellablewith(java.util.function.Consumer<? super T> onItem, java.lang.Runnable onComplete)Subscribes to theMultito start receiving the items.Cancellablewith(java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure)Subscribes to theMultito start receiving the items.Cancellablewith(java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure, java.lang.Runnable onComplete)Subscribes to theMultito start receiving the items.<S extends org.reactivestreams.Subscriber<? super T>>
SwithSubscriber(S subscriber)Subscribes to theMultito get a subscription and then start receiving items ( based on the passed requests).
-
-
-
Constructor Detail
-
MultiSubscribe
public MultiSubscribe(AbstractMulti<T> upstream)
-
-
Method Detail
-
withSubscriber
public <S extends org.reactivestreams.Subscriber<? super T>> S withSubscriber(S subscriber)
Subscribes to theMultito 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. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti.If the
Multirejects the subscription attempt or otherwise fails it will fire afailureevent receiving bySubscriber.onError(Throwable).- Type Parameters:
S- the subscriber type- Parameters:
subscriber- the subscriber, must not benull- Returns:
- the passed subscriber
-
withSubscriber
public <S extends MultiSubscriber<? super T>> S withSubscriber(S subscriber)
Subscribes to theMultito 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. EachSubscriptionwill work for only a singleMultiSubscriber. AMultiSubscribershould only subscribe once to a singleMulti.If the
Multirejects the subscription attempt or otherwise fails it will fire afailureevent receiving byMultiSubscriber.onFailure(Throwable).- Type Parameters:
S- the subscriber type- Parameters:
subscriber- the subscriber, must not benull- Returns:
- the passed subscriber
-
with
public Cancellable with(java.util.function.Consumer<? super org.reactivestreams.Subscription> onSubscription, java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure, java.lang.Runnable onComplete)
Subscribes to theMultito start receiving the items.This method accepts the following callbacks:
onSubscriptionreceives theSubscription, you must request items using theSubscription.request(long)methodonItemreceives the requested items if anyonFailurereceives the failure if anyonCompletereceives the completion event
This method returns a
Cancellableto cancel the subscription.This is a "factory method" and can be called multiple times, each time starting a new
Subscription. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti.- Parameters:
onSubscription- the callback receiving the subscription, must not benullonItem- the callback receiving the items, must not benullonFailure- the callback receiving the failure, must not benullonComplete- the callback receiving the completion event, must not benull- Returns:
- the cancellable object to cancel the subscription
-
with
@Experimental("Context support is a new experimental API introduced in Mutiny 1.3.0") public Cancellable with(Context context, java.util.function.Consumer<? super org.reactivestreams.Subscription> onSubscription, java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure, java.lang.Runnable onComplete)Subscribes to theMultito start receiving the items.This method accepts the following callbacks:
onSubscriptionreceives theSubscription, you must request items using theSubscription.request(long)methodonItemreceives the requested items if anyonFailurereceives the failure if anyonCompletereceives the completion event
This method returns a
Cancellableto cancel the subscription.This is a "factory method" and can be called multiple times, each time starting a new
Subscription. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti.- Parameters:
context- the context, must not benullonSubscription- the callback receiving the subscription, must not benullonItem- the callback receiving the items, must not benullonFailure- the callback receiving the failure, must not benullonComplete- the callback receiving the completion event, must not benull- Returns:
- the cancellable object to cancel the subscription
-
with
public Cancellable with(java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure, java.lang.Runnable onComplete)
Subscribes to theMultito start receiving the items.This method accepts the following callbacks:
onItemreceives the requested items if anyonFailurereceives the failure if anyonCompletereceives the completion event
This method returns a
Cancellableto cancel the subscription. Important: This method requestLong.MAX_VALUEitems.This is a "factory method" and can be called multiple times, each time starting a new
Subscription. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti.- Parameters:
onItem- the callback receiving the items, must not benullonFailure- the callback receiving the failure, must not benullonComplete- the callback receiving the completion event, must not benull- Returns:
- the cancellable object to cancel the subscription
-
with
@Experimental("Context support is a new experimental API introduced in Mutiny 1.3.0") public Cancellable with(Context context, java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure, java.lang.Runnable onComplete)Subscribes to theMultito start receiving the items.This method accepts the following callbacks:
onItemreceives the requested items if anyonFailurereceives the failure if anyonCompletereceives the completion event
This method returns a
Cancellableto cancel the subscription. Important: This method requestLong.MAX_VALUEitems.This is a "factory method" and can be called multiple times, each time starting a new
Subscription. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti.- Parameters:
context- the context, must not benullonItem- the callback receiving the items, must not benullonFailure- the callback receiving the failure, must not benullonComplete- the callback receiving the completion event, must not benull- Returns:
- the cancellable object to cancel the subscription
-
with
public Cancellable with(java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure)
Subscribes to theMultito start receiving the items.This method accepts the following callbacks:
onItemreceives the requested items if anyonFailurereceives the failure if any
So, you won't be notified on stream completion.
This method returns a
Cancellableto cancel the subscription. Important: This method requestLong.MAX_VALUEitems.This is a "factory method" and can be called multiple times, each time starting a new
Subscription. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti. *- Parameters:
onItem- the callback receiving the items, must not benullonFailure- the callback receiving the failure, must not benull- Returns:
- the cancellable object to cancel the subscription
-
with
@Experimental("Context support is a new experimental API introduced in Mutiny 1.3.0") public Cancellable with(Context context, java.util.function.Consumer<? super T> onItem, java.util.function.Consumer<? super java.lang.Throwable> onFailure)Subscribes to theMultito start receiving the items.This method accepts the following callbacks:
onItemreceives the requested items if anyonFailurereceives the failure if any
So, you won't be notified on stream completion.
This method returns a
Cancellableto cancel the subscription. Important: This method requestLong.MAX_VALUEitems.This is a "factory method" and can be called multiple times, each time starting a new
Subscription. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti. *- Parameters:
context- the context, must not benullonItem- the callback receiving the items, must not benullonFailure- the callback receiving the failure, must not benull- Returns:
- the cancellable object to cancel the subscription
-
with
public Cancellable with(java.util.function.Consumer<? super T> onItem)
Subscribes to theMultito start receiving the items.This method receives only the
onItemcallback, 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
Cancellableto cancel the subscription. Important: This method requestLong.MAX_VALUEitems.This is a "factory method" and can be called multiple times, each time starting a new
Subscription. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti. *- Parameters:
onItem- the callback receiving the items, must not benull- Returns:
- the cancellable object to cancel the subscription
-
with
@Experimental("Context support is a new experimental API introduced in Mutiny 1.3.0") public Cancellable with(Context context, java.util.function.Consumer<? super T> onItem)Subscribes to theMultito start receiving the items.This method receives only the
onItemcallback, 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
Cancellableto cancel the subscription. Important: This method requestLong.MAX_VALUEitems.This is a "factory method" and can be called multiple times, each time starting a new
Subscription. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti. *- Parameters:
context- the context, must not benullonItem- the callback receiving the items, must not benull- Returns:
- the cancellable object to cancel the subscription
-
with
public Cancellable with(java.util.function.Consumer<? super T> onItem, java.lang.Runnable onComplete)
Subscribes to theMultito start receiving the items.This method accepts the following callbacks:
onItemreceives the requested items if anyonCompletereceives the completion event
So, you won't be notified on failure.
This method returns a
Cancellableto cancel the subscription. Important: This method requestLong.MAX_VALUEitems.This is a "factory method" and can be called multiple times, each time starting a new
Subscription. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti.- Parameters:
onItem- the callback receiving the items, must not benullonComplete- the callback receiving the completion event, must not benull- Returns:
- the cancellable object to cancel the subscription
-
with
@Experimental("Context support is a new experimental API introduced in Mutiny 1.3.0") public Cancellable with(Context context, java.util.function.Consumer<? super T> onItem, java.lang.Runnable onComplete)Subscribes to theMultito start receiving the items.This method accepts the following callbacks:
onItemreceives the requested items if anyonCompletereceives the completion event
So, you won't be notified on failure.
This method returns a
Cancellableto cancel the subscription. Important: This method requestLong.MAX_VALUEitems.This is a "factory method" and can be called multiple times, each time starting a new
Subscription. EachSubscriptionwill work for only a singleSubscriber. ASubscribershould only subscribe once to a singleMulti.- Parameters:
context- the context, must not benullonItem- the callback receiving the items, must not benullonComplete- the callback receiving the completion event, must not benull- Returns:
- the cancellable object to cancel the subscription
-
asIterable
@CheckReturnValue public io.smallrye.mutiny.helpers.BlockingIterable<T> asIterable()
- Returns:
- a blocking iterable used to consume the items emitted by the upstream
Multi.
-
asIterable
@CheckReturnValue @Experimental("Context support is a new experimental API introduced in Mutiny 1.3.0") public io.smallrye.mutiny.helpers.BlockingIterable<T> asIterable(java.util.function.Supplier<Context> contextSupplier)- Parameters:
contextSupplier- the context supplier, must not benull, must not returnnull- Returns:
- a blocking iterable used to consume the items emitted by the upstream
Multi.
-
asIterable
@CheckReturnValue public io.smallrye.mutiny.helpers.BlockingIterable<T> asIterable(int batchSize, java.util.function.Supplier<java.util.Queue<T>> supplier)
Consumes the upstreamMultias an iterable.- Parameters:
batchSize- the number of elements stored in the queuesupplier- the supplier of queue used internally, must not benull, must not returnnull- Returns:
- a blocking iterable used to consume the items emitted by the upstream
Multi.
-
asIterable
@CheckReturnValue @Experimental("Context support is a new experimental API introduced in Mutiny 1.3.0") public io.smallrye.mutiny.helpers.BlockingIterable<T> asIterable(java.util.function.Supplier<Context> contextSupplier, int batchSize, java.util.function.Supplier<java.util.Queue<T>> queueSupplier)Consumes the upstreamMultias an iterable.- Parameters:
contextSupplier- the context supplier, must not benull, must not returnnullbatchSize- the number of elements stored in the queuequeueSupplier- the supplier of queue used internally, must not benull, must not returnnull- Returns:
- a blocking iterable used to consume the items emitted by the upstream
Multi.
-
asStream
@CheckReturnValue public java.util.stream.Stream<T> asStream()
- Returns:
- a blocking stream to consume the items from the upstream
Multi.
-
asStream
@CheckReturnValue @Experimental("Context support is a new experimental API introduced in Mutiny 1.3.0") public java.util.stream.Stream<T> asStream(java.util.function.Supplier<Context> contextSupplier)- Parameters:
contextSupplier- the context supplier, must not benull, must not returnnull- Returns:
- a blocking stream to consume the items from the upstream
Multi.
-
asStream
@CheckReturnValue public java.util.stream.Stream<T> asStream(int batchSize, java.util.function.Supplier<java.util.Queue<T>> supplier)
Consumes the items from the upstreamMultias a blocking stream.- Parameters:
batchSize- the number of element stored in the queuesupplier- the supplier of queue used internally, must not benull, must not returnnull- Returns:
- a blocking stream used to consume the items from
Multi
-
asStream
@CheckReturnValue @Experimental("Context support is a new experimental API introduced in Mutiny 1.3.0") public java.util.stream.Stream<T> asStream(java.util.function.Supplier<Context> contextSupplier, int batchSize, java.util.function.Supplier<java.util.Queue<T>> queueSupplier)Consumes the items from the upstreamMultias a blocking stream.- Parameters:
contextSupplier- the context supplier, must not benull, must not returnnullbatchSize- the number of element stored in the queuequeueSupplier- the supplier of queue used internally, must not benull, must not returnnull- Returns:
- a blocking stream used to consume the items from
Multi
-
-