DurablePromise

sealed interface DurablePromise<T>

A DurablePromise is a durable, distributed version of a Kotlin's Deferred, or more commonly of a future/promise. Restate keeps track of the DurablePromise across 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 to complete a durable promise, either by DurablePromiseHandle.resolve or DurablePromiseHandle.reject.

A DurablePromise is 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.

Functions

Link copied to clipboard
abstract suspend fun awaitable(): Awaitable<T>
Link copied to clipboard
abstract suspend fun peek(): Output<T>