Package dev.restate.sdk
Interface DurablePromise<T>
-
public interface DurablePromise<T>ADurablePromiseis a durable, distributed version of aCompletableFuture. Restate keeps track of theDurablePromiseacross restarts/failures.You can use this feature to implement interaction between different workflow handlers, e.g. to send a signal from a shared handler to the workflow handler.
Use
SharedWorkflowContext.promiseHandle(DurablePromiseKey)to complete a durable promise, either byDurablePromiseHandle.resolve(Object)orDurablePromiseHandle.reject(String).A
DurablePromiseis tied to a single workflow execution and can only be resolved or rejected while the workflow run is still ongoing. Once the workflow is cleaned up, all its associated promises with their completions will be cleaned up as well.NOTE: This interface MUST NOT be accessed concurrently since it can lead to different orderings of user actions, corrupting the execution of the invocation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Awaitable<T>awaitable()dev.restate.sdk.common.Output<T>peek()
-