Interface ActivityCompletionClient
ActivityExecutionContext.doNotCompleteOnReturn().
Use WorkflowClient.newActivityCompletionClient() to create an instance.
-
Method Summary
Modifier and TypeMethodDescription<R> voidcomplete(byte[] taskToken, R result) Completes the activity execution successfully.<R> voidCompletes the activity execution successfully.voidcompleteExceptionally(byte[] taskToken, Exception result) Completes the activity execution with failure.voidcompleteExceptionally(String workflowId, Optional<String> runId, String activityId, Exception result) Completes the activity execution with failure.voidcompleteExceptionallyStandalone(String activityId, Optional<String> activityRunId, Exception result) Completes a standalone activity execution with failure.<R> voidcompleteStandalone(String activityId, Optional<String> activityRunId, R result) Completes a standalone activity execution successfully.<V> voidheartbeat(byte[] taskToken, V details) Records a heartbeat for an activity.<V> voidRecords a heartbeat for an activity.<V> voidheartbeatStandalone(String activityId, Optional<String> activityRunId, V details) Records a heartbeat for a standalone activity.<V> voidreportCancellation(byte[] taskToken, V details) Confirms successful cancellation to the server.<V> voidreportCancellation(String workflowId, Optional<String> runId, String activityId, V details) Confirms successful cancellation to the server.<V> voidreportCancellationStandalone(String activityId, Optional<String> activityRunId, V details) Confirms successful cancellation of a standalone activity to the server.withContext(ActivitySerializationContext context) Supply this context if correct serialization of activity heartbeats, results or other payloads requiresDataConverter,PayloadConverterorPayloadCodecto be aware ofActivitySerializationContext.
-
Method Details
-
complete
Completes the activity execution successfully.- Parameters:
taskToken- token of the activity attempt to completeresult- of the activity execution- Throws:
ActivityCompletionException
-
complete
<R> void complete(String workflowId, Optional<String> runId, String activityId, R result) throws ActivityCompletionException Completes the activity execution successfully.This method is only for activities run within a workflow.
- Parameters:
workflowId- id of the workflow that started the activityrunId- optional run id of the workflow that started the activityactivityId- id of the activityresult- of the activity execution- Throws:
ActivityCompletionException
-
completeStandalone
@Experimental <R> void completeStandalone(String activityId, Optional<String> activityRunId, R result) throws ActivityCompletionException Completes a standalone activity execution successfully.Use this overload for standalone activities (not started from a workflow). For workflow-scheduled activities, use
complete(String, Optional, String, Object). To complete a standalone activity using a task token, usecomplete(byte[], Object).- Parameters:
activityId- id of the standalone activityactivityRunId- optional run id of the standalone activity, orOptional.empty()result- of the activity execution- Throws:
ActivityCompletionException
-
completeExceptionally
Completes the activity execution with failure.- Parameters:
taskToken- token of the activity attempt to completeresult- the exception to be used as a failure details object- Throws:
ActivityCompletionException
-
completeExceptionally
void completeExceptionally(String workflowId, Optional<String> runId, String activityId, Exception result) throws ActivityCompletionException Completes the activity execution with failure.This method is only for activities run within a workflow.
- Parameters:
workflowId- id of the workflow that started the activityrunId- optional run id of the workflow that started the activityactivityId- id of the activityresult- the exception to be used as a failure details object- Throws:
ActivityCompletionException
-
completeExceptionallyStandalone
@Experimental void completeExceptionallyStandalone(String activityId, Optional<String> activityRunId, Exception result) throws ActivityCompletionException Completes a standalone activity execution with failure.Use this overload for standalone activities (not started from a workflow). For workflow-scheduled activities, use
completeExceptionally(String, Optional, String, Exception). To complete a standalone activity with failure using a task token, usecompleteExceptionally(byte[], Exception).- Parameters:
activityId- id of the standalone activityactivityRunId- optional run id of the standalone activity, orOptional.empty()result- the exception to be used as a failure details object- Throws:
ActivityCompletionException
-
reportCancellation
Confirms successful cancellation to the server.- Parameters:
taskToken- token of the activity attemptdetails- details to record with the cancellation- Throws:
ActivityCompletionException
-
reportCancellation
<V> void reportCancellation(String workflowId, Optional<String> runId, String activityId, V details) throws ActivityCompletionException Confirms successful cancellation to the server.This method is only for activities run within a workflow.
- Parameters:
workflowId- id of the workflow that started the activityrunId- optional run id of the workflow that started the activityactivityId- id of the activitydetails- details to record with the cancellation- Throws:
ActivityCompletionException
-
reportCancellationStandalone
@Experimental <V> void reportCancellationStandalone(String activityId, Optional<String> activityRunId, V details) throws ActivityCompletionException Confirms successful cancellation of a standalone activity to the server.Use this overload for standalone activities (not started from a workflow). For workflow-scheduled activities, use
reportCancellation(String, Optional, String, Object). To confirm a successful cancellation of a standalone activity using a task token, usereportCancellation(byte[], Object).- Parameters:
activityId- id of the standalone activityactivityRunId- optional run id of the standalone activity, orOptional.empty()details- details to record with the cancellation- Throws:
ActivityCompletionException
-
heartbeat
Records a heartbeat for an activity.- Parameters:
taskToken- token of the activity attemptdetails- details to record with the heartbeat- Throws:
ActivityCompletionException- if activity should stop executing
-
heartbeat
<V> void heartbeat(String workflowId, Optional<String> runId, String activityId, V details) throws ActivityCompletionException Records a heartbeat for an activity.This method is only for activities run within a workflow.
- Parameters:
workflowId- id of the workflow that started the activityrunId- optional run id of the workflow that started the activityactivityId- id of the activitydetails- details to record with the heartbeat- Throws:
ActivityCompletionException- if activity should stop executing
-
heartbeatStandalone
@Experimental <V> void heartbeatStandalone(String activityId, Optional<String> activityRunId, V details) throws ActivityCompletionException Records a heartbeat for a standalone activity.Use this overload for standalone activities (not started from a workflow). For workflow-scheduled activities, use
heartbeat(String, Optional, String, Object). To record a heartbeeat for a standalone activity using a task token, useheartbeat(byte[], Object).- Parameters:
activityId- id of the standalone activityactivityRunId- optional run id of the standalone activity, orOptional.empty()details- details to record with the heartbeat- Throws:
ActivityCompletionException- if activity should stop executing
-
withContext
@Experimental @Nonnull ActivityCompletionClient withContext(@Nonnull ActivitySerializationContext context) Supply this context if correct serialization of activity heartbeats, results or other payloads requiresDataConverter,PayloadConverterorPayloadCodecto be aware ofActivitySerializationContext.- Parameters:
context- provides information to the data converter about the abstraction the data belongs to- Returns:
- an instance of DataConverter that may use the provided
contextfor serialization - See Also:
-