Class ActivityClientCallsInterceptorBase
java.lang.Object
io.temporal.common.interceptors.ActivityClientCallsInterceptorBase
- All Implemented Interfaces:
ActivityClientCallsInterceptor
public class ActivityClientCallsInterceptorBase
extends Object
implements ActivityClientCallsInterceptor
Convenience base class for
ActivityClientCallsInterceptor implementations.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.temporal.common.interceptors.ActivityClientCallsInterceptor
ActivityClientCallsInterceptor.CancelActivityInput, ActivityClientCallsInterceptor.CancelActivityOutput, ActivityClientCallsInterceptor.CountActivitiesInput, ActivityClientCallsInterceptor.CountActivitiesOutput, ActivityClientCallsInterceptor.DescribeActivityInput, ActivityClientCallsInterceptor.DescribeActivityOutput, ActivityClientCallsInterceptor.GetActivityResultInput<R>, ActivityClientCallsInterceptor.GetActivityResultOutput<R>, ActivityClientCallsInterceptor.ListActivitiesInput, ActivityClientCallsInterceptor.ListActivitiesOutput, ActivityClientCallsInterceptor.StartActivityInput, ActivityClientCallsInterceptor.StartActivityOutput, ActivityClientCallsInterceptor.TerminateActivityInput, ActivityClientCallsInterceptor.TerminateActivityOutput -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRequests cooperative cancellation of a running standalone activity.Returns the count of activity executions matching the Visibility query ininput.Returns the current execution description for a standalone activity.Synchronously long-polls the server until the activity completes, then deserializes and returns the result.Asynchronously polls for the activity result without blocking the calling thread.Returns a lazyStreamof activity execution metadata matching the Visibility query ininput.Schedules a standalone activity for execution.Forcefully terminates a running standalone activity.
-
Constructor Details
-
ActivityClientCallsInterceptorBase
-
-
Method Details
-
startActivity
public ActivityClientCallsInterceptor.StartActivityOutput startActivity(ActivityClientCallsInterceptor.StartActivityInput input) Description copied from interface:ActivityClientCallsInterceptorSchedules a standalone activity for execution. The activity type name, arguments, and scheduling options are carried ininput.- Specified by:
startActivityin interfaceActivityClientCallsInterceptor- Parameters:
input- activity type, raw arguments, scheduling options, and propagated header- Returns:
- output containing the caller-supplied activity ID and the run ID assigned by the server (if the server provides one)
-
getActivityResult
public <R> ActivityClientCallsInterceptor.GetActivityResultOutput<R> getActivityResult(ActivityClientCallsInterceptor.GetActivityResultInput<R> input) throws TimeoutException Description copied from interface:ActivityClientCallsInterceptorSynchronously long-polls the server until the activity completes, then deserializes and returns the result. Loops automatically on empty long-poll responses (server-side timeout with no outcome yet). Blocks the calling thread for the duration.- Specified by:
getActivityResultin interfaceActivityClientCallsInterceptor- Type Parameters:
R- the expected result type- Parameters:
input- activity ID, optional run ID, and result class and generic type- Returns:
- output wrapping the deserialized activity result
- Throws:
TimeoutException
-
getActivityResultAsync
public <R> CompletableFuture<ActivityClientCallsInterceptor.GetActivityResultOutput<R>> getActivityResultAsync(ActivityClientCallsInterceptor.GetActivityResultInput<R> input) Description copied from interface:ActivityClientCallsInterceptorAsynchronously polls for the activity result without blocking the calling thread. Returns aCompletableFuturethat completes with the deserialized result when the activity succeeds, or completes exceptionally withActivityFailedExceptionon failure, orTimeoutExceptionif the deadline ininputexpires before the activity completes.The default implementation wraps
ActivityClientCallsInterceptor.getActivityResult(io.temporal.common.interceptors.ActivityClientCallsInterceptor.GetActivityResultInput<R>)in aCompletableFuture.supplyAsync(java.util.function.Supplier<U>)call. Interceptors that want true non-blocking behavior should override this method.- Specified by:
getActivityResultAsyncin interfaceActivityClientCallsInterceptor- Type Parameters:
R- the expected result type- Parameters:
input- activity ID, optional run ID, result class and generic type, and timeout- Returns:
- a future that completes with output wrapping the deserialized activity result
-
describeActivity
public ActivityClientCallsInterceptor.DescribeActivityOutput describeActivity(ActivityClientCallsInterceptor.DescribeActivityInput input) Description copied from interface:ActivityClientCallsInterceptorReturns the current execution description for a standalone activity. If a long-poll token from a prior call is present ininput, the server blocks until the description changes or the poll times out, enabling efficient change detection.- Specified by:
describeActivityin interfaceActivityClientCallsInterceptor- Parameters:
input- activity ID, optional run ID, and optional long-poll token from a prior call- Returns:
- output containing the
ActivityExecutionDescription; the fresh long-poll token for the next call is stored inside the returnedActivityExecutionDescription
-
cancelActivity
public ActivityClientCallsInterceptor.CancelActivityOutput cancelActivity(ActivityClientCallsInterceptor.CancelActivityInput input) Description copied from interface:ActivityClientCallsInterceptorRequests cooperative cancellation of a running standalone activity. The activity will receive a cancellation request on its next heartbeat; it may choose to honour or ignore it.- Specified by:
cancelActivityin interfaceActivityClientCallsInterceptor- Parameters:
input- activity ID, optional run ID, and optional human-readable cancellation reason- Returns:
- an empty output object (reserved for future use)
-
terminateActivity
public ActivityClientCallsInterceptor.TerminateActivityOutput terminateActivity(ActivityClientCallsInterceptor.TerminateActivityInput input) Description copied from interface:ActivityClientCallsInterceptorForcefully terminates a running standalone activity. Unlike cancellation, termination is immediate and cannot be caught or suppressed by the activity.- Specified by:
terminateActivityin interfaceActivityClientCallsInterceptor- Parameters:
input- activity ID, optional run ID, and optional human-readable termination reason- Returns:
- an empty output object (reserved for future use)
-
listActivities
public ActivityClientCallsInterceptor.ListActivitiesOutput listActivities(ActivityClientCallsInterceptor.ListActivitiesInput input) Description copied from interface:ActivityClientCallsInterceptorReturns a lazyStreamof activity execution metadata matching the Visibility query ininput. Pages are fetched from the server on demand as the stream is consumed.- Specified by:
listActivitiesin interfaceActivityClientCallsInterceptor- Parameters:
input- Visibility query string and listing options (e.g. page-size limit)- Returns:
- output wrapping a stream of
ActivityExecutionMetadata
-
countActivities
public ActivityClientCallsInterceptor.CountActivitiesOutput countActivities(ActivityClientCallsInterceptor.CountActivitiesInput input) Description copied from interface:ActivityClientCallsInterceptorReturns the count of activity executions matching the Visibility query ininput.- Specified by:
countActivitiesin interfaceActivityClientCallsInterceptor- Parameters:
input- Visibility query string and count options- Returns:
- output wrapping the
ActivityExecutionCount
-