///<summary>/// Indicate that the Step Functions task, indicated by the/// task token, has completed successfully.///</summary>///<param name="taskToken">Identifies the task.</param>///<param name="taskResponse">The response received from executing the task.</param>///<returns>A Boolean value indicating the success of the action.</returns>publicasync Task<bool> SendTaskSuccessAsync(string taskToken, string taskResponse){var response = await _amazonStepFunctions.SendTaskSuccessAsync(new SendTaskSuccessRequest
{ TaskToken = taskToken, Output = taskResponse });
return response.HttpStatusCode == System.Net.HttpStatusCode.OK;
}
classActivity:"""Encapsulates Step Function activity actions."""def__init__(self, stepfunctions_client):"""
:param stepfunctions_client: A Boto3 Step Functions client.
"""
self.stepfunctions_client = stepfunctions_client
defsend_task_success(self, task_token, task_response):"""
Sends a success response to a waiting activity step. A state machine with an
activity step waits for the activity to get task data and then respond with
either success or failure before it resumes processing.
:param task_token: The token associated with the task. This is included in the
response to the get_activity_task action and must be sent
without modification.
:param task_response: The response data from the activity. This data is
received and processed by the state machine.
"""try:
self.stepfunctions_client.send_task_success(
taskToken=task_token, output=task_response
)
except ClientError as err:
logger.error(
"Couldn't send task success. Here's why: %s: %s",
err.response["Error"]["Code"],
err.response["Error"]["Message"],
)
raise
有关 API 的详细信息,请参阅适用SendTaskSuccess于 Python 的AWS SDK (Boto3) API 参考。
///<summary>/// Indicate that the Step Functions task, indicated by the/// task token, has completed successfully.///</summary>///<param name="taskToken">Identifies the task.</param>///<param name="taskResponse">The response received from executing the task.</param>///<returns>A Boolean value indicating the success of the action.</returns>publicasync Task<bool> SendTaskSuccessAsync(string taskToken, string taskResponse){var response = await _amazonStepFunctions.SendTaskSuccessAsync(new SendTaskSuccessRequest
{ TaskToken = taskToken, Output = taskResponse });
return response.HttpStatusCode == System.Net.HttpStatusCode.OK;
}