Package dev.restate.sdk
Interface SharedWorkflowContext
- All Superinterfaces:
Context
,SharedObjectContext
- All Known Subinterfaces:
WorkflowContext
This interface can be used only within shared handlers of workflow. It extends
Context
adding access to the workflow instance key-value state storage and to the DurablePromise
API.
NOTE: This interface MUST NOT be accessed concurrently since it can lead to different orderings of user actions, corrupting the execution of the invocation.
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<T> DurablePromise
<T> promise
(DurablePromiseKey<T> key) Create aDurablePromise
for the given key.<T> DurablePromiseHandle
<T> promiseHandle
(DurablePromiseKey<T> key) Create a newDurablePromiseHandle
for the provided key.Methods inherited from interface dev.restate.sdk.Context
awakeable, awakeableHandle, call, call, random, request, run, run, run, run, run, run, run, run, send, send, send, send, sleep, timer
Methods inherited from interface dev.restate.sdk.SharedObjectContext
get, key, stateKeys
-
Method Details
-
promise
Create aDurablePromise
for the given key.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.
- Returns:
- the
DurablePromise
. - See Also:
-
promiseHandle
Create a newDurablePromiseHandle
for the provided key. You can use it toDurablePromiseHandle.resolve(Object)
orDurablePromiseHandle.reject(String)
the givenDurablePromise
.- See Also:
-