Package dev.restate.sdk
Class Awakeable<T>
- java.lang.Object
-
- dev.restate.sdk.Awaitable<U>
-
- dev.restate.sdk.Awakeable<T>
-
@NotThreadSafe public final class Awakeable<T> extends Awaitable<U>
AnAwakeableis a special type ofAwaitablewhich can be arbitrarily completed by another service, by addressing it with itsid().It can be used to let a service wait on a specific condition/result, which is fulfilled by another service or by an external system at a later point in time.
For example, you can send a Kafka record including the
id(), and then let another service consume from Kafka the responses of given external system interaction by usingContext.awakeableHandle(String).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description dev.restate.sdk.common.syscalls.Result<U>awaitResult()protected dev.restate.sdk.common.syscalls.Deferred<?>deferred()java.lang.Stringid()
-
-
-
Method Detail
-
id
public java.lang.String id()
- Returns:
- the unique identifier of this
Awakeableinstance.
-
deferred
protected dev.restate.sdk.common.syscalls.Deferred<?> deferred()
-
awaitResult
public dev.restate.sdk.common.syscalls.Result<U> awaitResult() throws dev.restate.sdk.common.TerminalException- Specified by:
awaitResultin classAwaitable<U>- Throws:
dev.restate.sdk.common.TerminalException
-
-