- Type Parameters:
T- the type of item
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLikewithSubscriber(UniSubscriber)but provides aCompletableFutureto retrieve the completed item (potentiallynull) and allow chaining operations.asCompletionStage(Context context) LikewithSubscriber(UniSubscriber)but provides aCompletableFutureto retrieve the completed item (potentiallynull) and allow chaining operations.LikewithSubscriber(UniSubscriber)with creating an artificialUniSubscribercalling theonItemwhen the item is received.with(Context context, Consumer<? super T> onItemCallback, Consumer<? super Throwable> onFailureCallback) LikewithSubscriber(UniSubscriber)with creating an artificialUniSubscribercalling theonItemandonFailurecallbacks when the events are received.LikewithSubscriber(UniSubscriber)with creating an artificialUniSubscribercalling theonItemwhen the item is received.LikewithSubscriber(UniSubscriber)with creating an artificialUniSubscribercalling theonItemandonFailurecallbacks when the events are received.<S extends UniSubscriber<? super T>>
SwithSerializedSubscriber(S subscriber) Requests theUnito start computing the item, but wraps the provided subscriber in aUniSerializedSubscriberinstance that enforces correct events ordering.<S extends UniSubscriber<? super T>>
SwithSubscriber(S subscriber) Requests theUnito start computing the item.
-
Constructor Details
-
UniSubscribe
-
-
Method Details
-
withSubscriber
Requests theUnito start computing the item.This is a "factory method" and can be called multiple times, each time starting a new
UniSubscription. EachUniSubscriptionwill work for only a singleUniSubscriber. AUniSubscribershould only subscribe once to a singleUni.If the
Unirejects the subscription attempt or otherwise fails it will fire afailureevent receiving byUniSubscriber.onFailure(Throwable).- Type Parameters:
S- the type of subscriber returned- Parameters:
subscriber- the subscriber, must not benull- Returns:
- the passed subscriber
-
withSerializedSubscriber
Requests theUnito start computing the item, but wraps the provided subscriber in aUniSerializedSubscriberinstance that enforces correct events ordering.This is a "factory method" and can be called multiple times, each time starting a new
UniSubscription. EachUniSubscriptionwill work for only a singleUniSubscriber. AUniSubscribershould only subscribe once to a singleUni.If the
Unirejects the subscription attempt or otherwise fails it will fire afailureevent receiving byUniSubscriber.onFailure(Throwable).- Type Parameters:
S- the type of subscriber returned- Parameters:
subscriber- the subscriber, must not benull- Returns:
- the passed subscriber
-
with
public Cancellable with(Consumer<? super T> onItemCallback, Consumer<? super Throwable> onFailureCallback) LikewithSubscriber(UniSubscriber)with creating an artificialUniSubscribercalling theonItemandonFailurecallbacks when the events are received.Unlike
withSubscriber(UniSubscriber), this method returns the subscription that can be used to cancel the subscription.- Parameters:
onItemCallback- callback invoked when the an item event is received, potentially called withnullis received. The callback must not benullonFailureCallback- callback invoked when a failure event is received, must not benull- Returns:
- an object to cancel the computation
-
with
public Cancellable with(Context context, Consumer<? super T> onItemCallback, Consumer<? super Throwable> onFailureCallback) LikewithSubscriber(UniSubscriber)with creating an artificialUniSubscribercalling theonItemandonFailurecallbacks when the events are received.Unlike
withSubscriber(UniSubscriber), this method returns the subscription that can be used to cancel the subscription.- Parameters:
context- the context, must not benullonItemCallback- callback invoked when the an item event is received, potentially called withnullis received. The callback must not benullonFailureCallback- callback invoked when a failure event is received, must not benull- Returns:
- an object to cancel the computation
-
with
LikewithSubscriber(UniSubscriber)with creating an artificialUniSubscribercalling theonItemwhen the item is received.Unlike
withSubscriber(UniSubscriber), this method returns the subscription that can be used to cancel the subscription.Unlike
with(Consumer, Consumer), this method does not handle failure, and the failure event is dropped.- Parameters:
context- the context, must not benullonItemCallback- callback invoked when the an item event is received, potentially called withnullis received. The callback must not benull- Returns:
- an object to cancel the computation
-
with
LikewithSubscriber(UniSubscriber)with creating an artificialUniSubscribercalling theonItemwhen the item is received.Unlike
withSubscriber(UniSubscriber), this method returns the subscription that can be used to cancel the subscription.Unlike
with(Consumer, Consumer), this method does not handle failure, and the failure event is dropped.- Parameters:
onItemCallback- callback invoked when the an item event is received, potentially called withnullis received. The callback must not benull- Returns:
- an object to cancel the computation
-
asCompletionStage
LikewithSubscriber(UniSubscriber)but provides aCompletableFutureto retrieve the completed item (potentiallynull) and allow chaining operations.- Returns:
- a
CompletableFutureto retrieve the item and chain operations on the resolved item or failure. The returnedCompletableFuturecan also be used to cancel the computation.
-
asCompletionStage
LikewithSubscriber(UniSubscriber)but provides aCompletableFutureto retrieve the completed item (potentiallynull) and allow chaining operations.- Parameters:
context- the context, must not benull- Returns:
- a
CompletableFutureto retrieve the item and chain operations on the resolved item or failure. The returnedCompletableFuturecan also be used to cancel the computation.
-