recordActivityTaskHeartbeat method
Used by activity workers to report to the service that the
ActivityTask represented by the specified taskToken is
still making progress. The worker can also specify details of the
progress, for example percent complete, using the details
parameter. This action can also be used by the worker as a mechanism to
check if cancellation is being requested for the activity task. If a
cancellation is being attempted for the specified task, then the boolean
cancelRequested flag returned by the service is set to
true.
This action resets the taskHeartbeatTimeout clock. The
taskHeartbeatTimeout is specified in
RegisterActivityType.
This action doesn't in itself create an event in the workflow execution
history. However, if the task times out, the workflow execution history
contains a ActivityTaskTimedOut event that contains the
information from the last heartbeat generated by the activity worker.
Access Control
You can use IAM policies to control this action's access to Amazon SWF resources as follows:
-
Use a
Resourceelement with the domain name to limit the action to only specified domains. -
Use an
Actionelement to allow or deny permission to call this action. - You cannot use an IAM policy to constrain this action's parameters.
cause parameter is
set to OPERATION_NOT_PERMITTED. For details and example IAM
policies, see Using
IAM to Manage Access to Amazon SWF Workflows in the Amazon SWF
Developer Guide.
May throw UnknownResourceFault. May throw OperationNotPermittedFault.
Parameter taskToken :
The taskToken of the ActivityTask.
Parameter details :
If specified, contains details about the progress of the task.
Implementation
Future<ActivityTaskStatus> recordActivityTaskHeartbeat({
required String taskToken,
String? details,
}) async {
ArgumentError.checkNotNull(taskToken, 'taskToken');
_s.validateStringLength(
'taskToken',
taskToken,
1,
1024,
isRequired: true,
);
_s.validateStringLength(
'details',
details,
0,
2048,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'SimpleWorkflowService.RecordActivityTaskHeartbeat'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'taskToken': taskToken,
if (details != null) 'details': details,
},
);
return ActivityTaskStatus.fromJson(jsonResponse.body);
}