sendTaskHeartbeat method

Future<void> sendTaskHeartbeat({
  1. required String taskToken,
})

Used by activity workers and task states using the callback pattern to report to Step Functions that the task represented by the specified taskToken is still making progress. This action resets the Heartbeat clock. The Heartbeat threshold is specified in the state machine's Amazon States Language definition (HeartbeatSeconds). This action does not in itself create an event in the execution history. However, if the task times out, the execution history contains an ActivityTimedOut entry for activities, or a TaskTimedOut entry for for tasks using the job run or callback pattern.

May throw TaskDoesNotExist. May throw InvalidToken. May throw TaskTimedOut.

Parameter taskToken : The token that represents this task. Task tokens are generated by Step Functions when tasks are assigned to a worker, or in the context object when a workflow enters a task state. See GetActivityTaskOutput$taskToken.

Implementation

Future<void> sendTaskHeartbeat({
  required String taskToken,
}) async {
  ArgumentError.checkNotNull(taskToken, 'taskToken');
  _s.validateStringLength(
    'taskToken',
    taskToken,
    1,
    1024,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSStepFunctions.SendTaskHeartbeat'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'taskToken': taskToken,
    },
  );
}