Package dev.restate.sdk
Interface SharedWorkflowContext
-
- All Superinterfaces:
Context,SharedObjectContext
- All Known Subinterfaces:
WorkflowContext
public interface SharedWorkflowContext extends SharedObjectContext
This interface can be used only within shared handlers of workflow. It extendsContextadding access to the workflow instance key-value state storage and to theDurablePromiseAPI.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:
Context,SharedObjectContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> DurablePromise<T>promise(dev.restate.sdk.common.DurablePromiseKey<T> key)Create aDurablePromisefor the given key.<T> DurablePromiseHandle<T>promiseHandle(dev.restate.sdk.common.DurablePromiseKey<T> key)Create a newDurablePromiseHandlefor the provided key.-
Methods inherited from interface dev.restate.sdk.Context
awakeable, awakeableHandle, call, call, random, request, run, run, run, run, send, send, send, send, sleep, timer
-
Methods inherited from interface dev.restate.sdk.SharedObjectContext
get, key, stateKeys
-
-
-
-
Method Detail
-
promise
<T> DurablePromise<T> promise(dev.restate.sdk.common.DurablePromiseKey<T> key)
Create aDurablePromisefor 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:
DurablePromise
-
promiseHandle
<T> DurablePromiseHandle<T> promiseHandle(dev.restate.sdk.common.DurablePromiseKey<T> key)
Create a newDurablePromiseHandlefor the provided key. You can use it toDurablePromiseHandle.resolve(Object)orDurablePromiseHandle.reject(String)the givenDurablePromise.- See Also:
DurablePromise
-
-