Interface DurablePromise<T>


public interface DurablePromise<T>
A DurablePromise is a durable, distributed version of a CompletableFuture. 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(DurablePromiseKey) to complete a durable promise, either by DurablePromiseHandle.resolve(Object) or DurablePromiseHandle.reject(String).

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.

  • Method Summary

    Modifier and Type
    Method
    Description
    default DurableFuture<T>
    Deprecated, for removal: This API element is subject to removal in a future version.
    Use future() instead.
     
     
  • Method Details

    • future

      DurableFuture<T> future()
      Returns:
      the future to await the promise result on.
    • awaitable

      @Deprecated(forRemoval=true, since="2.0") default DurableFuture<T> awaitable()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use future() instead.
    • peek

      Output<T> peek()
      Returns:
      the value, if already present, otherwise returns an empty optional.