Interface ActivityHandle<R>
- Type Parameters:
R- the result type of the activity
- All Superinterfaces:
UntypedActivityHandle
A typed handle to a standalone activity execution. Extends
UntypedActivityHandle with
typed result methods.
Obtain an instance via ActivityClient.start(String, Class, StartActivityOptions, Object...) or ActivityClient.getHandle(String, String, Class).
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <R> ActivityHandle<R> fromUntyped(UntypedActivityHandle handle, Class<R> resultClass) Wraps anUntypedActivityHandlewith a known result type.static <R> ActivityHandle<R> fromUntyped(UntypedActivityHandle handle, Class<R> resultClass, Type resultType) Wraps anUntypedActivityHandlewith a known result type for generic types.Blocks until the standalone activity completes and returns the typed result.Blocks until the standalone activity completes and returns the typed result, or throws if the client-side timeout expires first.Returns a future that completes when the activity completes and resolves to the typed result.getResultAsync(long timeout, TimeUnit unit) Returns a future that completes when the activity completes, or fails withTimeoutExceptionif the activity does not complete within the specified timeout.Methods inherited from interface io.temporal.client.UntypedActivityHandle
cancel, cancel, describe, getActivityId, getActivityRunId, getResult, getResult, getResult, getResult, getResultAsync, getResultAsync, getResultAsync, getResultAsync, terminate, terminate
-
Method Details
-
getResult
R getResult()Blocks until the standalone activity completes and returns the typed result.- Throws:
ActivityFailedException- if the activity failed, timed out, or was cancelled
-
getResult
Blocks until the standalone activity completes and returns the typed result, or throws if the client-side timeout expires first.- Parameters:
timeout- maximum time to waitunit- unit oftimeout- Throws:
ActivityFailedException- if the activity failed, timed out on the server, or was cancelledTimeoutException- iftimeoutexpires before the activity completes
-
getResultAsync
CompletableFuture<R> getResultAsync()Returns a future that completes when the activity completes and resolves to the typed result. -
getResultAsync
Returns a future that completes when the activity completes, or fails withTimeoutExceptionif the activity does not complete within the specified timeout.- Parameters:
timeout- maximum time to waitunit- unit oftimeout
-
fromUntyped
Wraps anUntypedActivityHandlewith a known result type.- Parameters:
handle- the untyped handle to wrapresultClass- the class to deserialize the result into- Returns:
- a typed handle
-
fromUntyped
static <R> ActivityHandle<R> fromUntyped(UntypedActivityHandle handle, Class<R> resultClass, @Nullable Type resultType) Wraps anUntypedActivityHandlewith a known result type for generic types.- Parameters:
handle- the untyped handle to wrapresultClass- the class to deserialize the result intoresultType- the generic type; may benull- Returns:
- a typed handle
-