sendTaskSuccess method

Future<void> sendTaskSuccess({
  1. required String output,
  2. required String taskToken,
})

Used by activity workers and task states using the callback pattern to report that the task identified by the taskToken completed successfully.

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

Parameter output : The JSON output of the task. Length constraints apply to the payload size, and are expressed as bytes in UTF-8 encoding.

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> sendTaskSuccess({
  required String output,
  required String taskToken,
}) async {
  ArgumentError.checkNotNull(output, 'output');
  _s.validateStringLength(
    'output',
    output,
    0,
    262144,
    isRequired: true,
  );
  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.SendTaskSuccess'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'output': output,
      'taskToken': taskToken,
    },
  );
}