Interface NexusOperationHandle<R>
- Type Parameters:
R- the result type of the Nexus operation
- All Superinterfaces:
UntypedNexusOperationHandle
A typed handle to a standalone Nexus operation execution. Extends
UntypedNexusOperationHandle with typed result methods bound to a known result type.
Obtain an instance via NexusServiceClient or by wrapping an UntypedNexusOperationHandle (returned by NexusClient.getHandle(String, String)) with
fromUntyped(UntypedNexusOperationHandle, Class).
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic <R> NexusOperationHandle<R> fromUntyped(UntypedNexusOperationHandle handle, Class<R> resultClass) Wraps anUntypedNexusOperationHandlewith a known result type.static <R> NexusOperationHandle<R> fromUntyped(UntypedNexusOperationHandle handle, Class<R> resultClass, Type resultType) Wraps anUntypedNexusOperationHandlewith a known result type for generic types.Blocks until the Nexus operation completes and returns the typed result.Blocks until the Nexus operation completes and returns the typed result, or throws if the client-side timeout expires first.Returns a future that completes when the Nexus operation completes with the typed result.getResultAsync(long timeout, TimeUnit unit) Returns a future that completes with the typed result, or completes exceptionally with aTimeoutExceptioniftimeoutelapses before the operation completes.Methods inherited from interface io.temporal.client.UntypedNexusOperationHandle
cancel, cancel, describe, getNexusOperationId, getNexusOperationRunId, getResult, getResult, getResult, getResult, getResultAsync, getResultAsync, getResultAsync, getResultAsync, terminate, terminate
-
Method Details
-
fromUntyped
static <R> NexusOperationHandle<R> fromUntyped(UntypedNexusOperationHandle handle, Class<R> resultClass) Wraps anUntypedNexusOperationHandlewith 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> NexusOperationHandle<R> fromUntyped(UntypedNexusOperationHandle handle, Class<R> resultClass, @Nullable Type resultType) Wraps anUntypedNexusOperationHandlewith a known result type for generic types. Pass a non-nullresultTypewhen the result is a generic type whose parameters cannot be captured byClassalone (e.g.List<String>).- Parameters:
handle- the untyped handle to wrapresultClass- the class to deserialize the result intoresultType- the generic type; may benull- Returns:
- a typed handle
-
getResult
R getResult()Blocks until the Nexus operation completes and returns the typed result.- Throws:
NexusOperationException- if the operation failed, timed out, or was cancelled
-
getResult
Blocks until the Nexus operation completes and returns the typed result, or throws if the client-side timeout expires first.- Parameters:
timeout- maximum time to waitunit- unit oftimeout- Throws:
NexusOperationException- if the operation failed, timed out on the server, or was cancelledTimeoutException- iftimeoutexpires before the operation completes
-
getResultAsync
CompletableFuture<R> getResultAsync()Returns a future that completes when the Nexus operation completes with the typed result. -
getResultAsync
Returns a future that completes with the typed result, or completes exceptionally with aTimeoutExceptioniftimeoutelapses before the operation completes.- Parameters:
timeout- maximum time to waitunit- unit oftimeout
-