Class TemporalOperationResult<R>
java.lang.Object
io.temporal.nexus.TemporalOperationResult<R>
Unified result type for Temporal-backed Nexus operations. Encapsulates either a synchronous
result or an async operation token.
Use sync(Object) for operations that complete immediately (e.g., signals). Use async(String) for operations that return an operation token for async completion (e.g., start
workflow).
-
Method Summary
Modifier and TypeMethodDescriptionstatic <R> TemporalOperationResult<R> Creates an asynchronous result backed by an operation token.Returns the async operation token.Returns the synchronous result value.booleanisAsync()Returns true if this is an asynchronous result backed by an operation token.booleanisSync()Returns true if this is a synchronous result.static <R> TemporalOperationResult<R> sync(R value) Creates a synchronous result.
-
Method Details
-
sync
Creates a synchronous result.- Parameters:
value- the result value, may be null- Returns:
- a sync result wrapping the given value
-
async
Creates an asynchronous result backed by an operation token.- Parameters:
operationToken- the operation token identifying the async operation- Returns:
- an async result wrapping the given token
- Throws:
IllegalArgumentException- if operationToken is null or empty
-
isSync
public boolean isSync()Returns true if this is a synchronous result. -
isAsync
public boolean isAsync()Returns true if this is an asynchronous result backed by an operation token. -
getSyncResult
Returns the synchronous result value.- Returns:
- the sync result value (may be null if the operation produced a null sync value)
- Throws:
IllegalStateException- if this is an async result; checkisSync()first
-
getAsyncOperationToken
Returns the async operation token.- Returns:
- the operation token
- Throws:
IllegalStateException- if this is a sync result; checkisAsync()first
-