Package com.forgerock.reactive
Interface Completable
-
- All Superinterfaces:
org.reactivestreams.Publisher<Void>
public interface Completable extends org.reactivestreams.Publisher<Void>
Completableis used to communicates a terminated operation which doesn't produce a result. It extendsPublisherby providing additional reactive methods allowing to act on it. The goal of this interface is to decouple ourself from reactive framework (RxJava/Reactor).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceCompletable.EmitterAdapts the streaming api to a callback one.static interfaceCompletable.SubscriberSubscriber is notified when the operation has been completed, successfully or not.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompletabledoAfterTerminate(Action onAfterTerminate)Returns aCompletableinstance that calls the given onTerminate callback after this Completable completes normally or with an exception.CompletableonErrorResumeWith(org.forgerock.util.Function<Throwable,Completable,Exception> function)When an error occurs in this completable, continue the processing with the newCompletableprovided by the function.voidsubscribe()Subscribes to thisCompletable.voidsubscribe(Action completeAction, Consumer<Throwable> errorConsumer)Subscribe to the result of thisCompletable.<V> Single<V>toSingle(V value)Returns aSinglewhich will complete with the provided value once thisCompletablecompletes.
-
-
-
Method Detail
-
onErrorResumeWith
Completable onErrorResumeWith(org.forgerock.util.Function<Throwable,Completable,Exception> function)
When an error occurs in this completable, continue the processing with the newCompletableprovided by the function.- Parameters:
function- Generates the stream which must will used to resume operation when thisCompletablefailed.- Returns:
- A new
Completable
-
doAfterTerminate
Completable doAfterTerminate(Action onAfterTerminate)
Returns aCompletableinstance that calls the given onTerminate callback after this Completable completes normally or with an exception.- Parameters:
onAfterTerminate- the callback to call after thisCompletableterminates- Returns:
- the new
Completableinstance
-
toSingle
<V> Single<V> toSingle(V value)
Returns aSinglewhich will complete with the provided value once thisCompletablecompletes.- Type Parameters:
V- Type of the value to emit- Parameters:
value- The value to emit on completion- Returns:
- A new
Single
-
subscribe
void subscribe(Action completeAction, Consumer<Throwable> errorConsumer)
Subscribe to the result of thisCompletable.
-
subscribe
void subscribe()
Subscribes to thisCompletable.
-
-