public class AsyncRegistration extends Object implements Registration
Registration.| Constructor and Description |
|---|
AsyncRegistration(CompletableFuture<Void> requestAck,
Supplier<CompletableFuture<Void>> cancelAction)
Construct a
AsyncRegistration, using the given requestAck on awaitAck(long, TimeUnit)
and onAck(Runnable), and the given cancelAction on cancel(). |
| Modifier and Type | Method and Description |
|---|---|
Registration |
awaitAck(long timeout,
TimeUnit unit)
Wait for the acknowledgement of the original instruction
this Registration corresponds to. |
CompletableFuture<Void> |
cancel()
Cancel the registration from which this instance was returned.
|
Registration |
onAck(Runnable runnable)
Registers the given
runnable to this Registration to be executed when the acknowledgement
of this Registration is received. |
public AsyncRegistration(CompletableFuture<Void> requestAck, Supplier<CompletableFuture<Void>> cancelAction)
AsyncRegistration, using the given requestAck on awaitAck(long, TimeUnit)
and onAck(Runnable), and the given cancelAction on cancel().requestAck - the CompletableFuture to wait for on #awaitAck(long, TimeUnit)cancelAction - the Supplier of the CompletableFuture to retrieve on cancel()public CompletableFuture<Void> cancel()
Registrationcancel in interface RegistrationCompletableFuture of Void to react when this Registration has been
canceledpublic Registration awaitAck(long timeout, TimeUnit unit) throws TimeoutException, InterruptedException
Registrationthis Registration corresponds to. Allows
for the addition of further logic to this Registration, like invoking Registration.onAck(Runnable) for
example.awaitAck in interface Registrationtimeout - the duration to wait until the operation has been acknowledgedunit - the TimeUnit for the given timeout to wait until the operation has been
acknowledgedthis Registration to support a fluent APITimeoutException - is thrown when the given timeout and unit is surpassedInterruptedException - is thrown when the thread waiting for the acknowledgement is interruptedpublic Registration onAck(Runnable runnable)
Registrationrunnable to this Registration to be executed when the acknowledgement
of this Registration is received. Allows for the addition of further logic to this
Registration, like invoking Registration.awaitAck(long, TimeUnit) for example.onAck in interface Registrationrunnable - the Runnable to execute when the acknowledgement of this Registration is
receivedthis Registration to support a fluent APICopyright © 2020–2022 AxonIQ BV. All rights reserved.