Package io.temporal.client
Interface ActivityCompletionClient
-
public interface ActivityCompletionClientUsed to complete asynchronously activities that calledActivityExecutionContext.doNotCompleteOnReturn().Use
WorkflowClient.newActivityCompletionClient()to create an instance.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <R> voidcomplete(byte[] taskToken, R result)Completes the activity execution successfully.<R> voidcomplete(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, R result)Completes the activity execution successfully.voidcompleteExceptionally(byte[] taskToken, java.lang.Exception result)Completes the activity execution with failure.voidcompleteExceptionally(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, java.lang.Exception result)Completes the activity execution with failure.<V> voidheartbeat(byte[] taskToken, V details)Records a heartbeat for an activity.<V> voidheartbeat(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, V details)Records a heartbeat for an activity.<V> voidreportCancellation(byte[] taskToken, V details)Confirms successful cancellation to the server.<V> voidreportCancellation(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, V details)Confirms successful cancellation to the server.ActivityCompletionClientwithContext(ActivitySerializationContext context)Supply this context if correct serialization of activity heartbeats, results or other payloads requiresDataConverter,PayloadConverterorPayloadCodecto be aware ofActivitySerializationContext.
-
-
-
Method Detail
-
complete
<R> void complete(byte[] taskToken, R result) throws ActivityCompletionExceptionCompletes the activity execution successfully.- Parameters:
taskToken- token of the activity attempt to completeresult- of the activity execution- Throws:
ActivityCompletionException
-
complete
<R> void complete(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, R result) throws ActivityCompletionExceptionCompletes the activity execution successfully.- 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
-
completeExceptionally
void completeExceptionally(byte[] taskToken, java.lang.Exception result) throws ActivityCompletionExceptionCompletes 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(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, java.lang.Exception result) throws ActivityCompletionExceptionCompletes the activity execution with failure.- 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
-
reportCancellation
<V> void reportCancellation(byte[] taskToken, V details) throws ActivityCompletionExceptionConfirms successful cancellation to the server.- Parameters:
taskToken- token of the activity attemptdetails- details to record with the cancellation- Throws:
ActivityCompletionException
-
reportCancellation
<V> void reportCancellation(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, V details) throws ActivityCompletionExceptionConfirms successful cancellation to the server.- 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
-
heartbeat
<V> void heartbeat(byte[] taskToken, V details) throws ActivityCompletionExceptionRecords 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(java.lang.String workflowId, java.util.Optional<java.lang.String> runId, java.lang.String activityId, V details) throws ActivityCompletionExceptionRecords a heartbeat for an activity.- 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
-
withContext
@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:
SerializationContext
-
-