Package dev.restate.sdk
Interface SharedObjectContext
- All Superinterfaces:
Context
- All Known Subinterfaces:
ObjectContext
,SharedWorkflowContext
,WorkflowContext
This interface can be used only within shared handlers of virtual objects. It extends
Context
adding access to the virtual object instance key-value state storage.
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
Methods inherited from interface dev.restate.sdk.Context
awakeable, awakeable, awakeableHandle, call, invocationHandle, invocationHandle, invocationHandle, random, request, run, run, run, run, run, run, run, run, run, runAsync, runAsync, runAsync, runAsync, runAsync, runAsync, runAsync, runAsync, runAsync, send, send, sleep, timer, timer
-
Method Details
-
key
String key()- Returns:
- the key of this object
-
get
- Parameters:
key
- identifying the state to get and its type.- Returns:
- an
Optional
containing the stored state deserialized or an emptyOptional
if not set yet. - Throws:
RuntimeException
- when the state cannot be deserialized.
-
stateKeys
Collection<String> stateKeys()Gets all the known state keys for this virtual object instance.- Returns:
- the immutable collection of known state keys.
-