EventBridge for Amazon SWF 実行状況の変更 - Amazon Simple Workflow Service

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

EventBridge for Amazon SWF 実行状況の変更

Amazon EventBridge を使用して、AWS リソースの状態の変更またはイベントに応答します。Amazon SWF がイベントを発行すると、常にアカウントのデフォルトの EventBridge イベントバスに移動します。イベントのルールを作成し、それをデフォルトのイベントバスに関連付け、EventBridge がルールに一致するイベントを受信したときに実行するターゲットアクションを指定できます。これにより、GetWorkflowExecutionHistory API を使用して継続的にポーリングすることなく、ワークフローをモニタリングできます。ワークフロー実行の変更に基づいて、EventBridge ターゲットを使用して AWS Lambda 関数を呼び出したり、Amazon Simple Notification Service (Amazon SNS) トピックにメッセージを公開したりできます。

実行ステータス変更イベントの全内容を確認するには、DescribeWorkflowExecution を使用します。

詳細については、「Amazon EventBridge User Guide」(Amazon EventBridge ユーザーガイド) を参照してください。

EventBridge イベント

履歴イベントタイプには、実行状態の変更が含まれます。各イベントの detail セクションには、少なくとも次のパラメータが含まれています。

  • eventId: GetWorkflowExecutionHistory によって表示されるイベント ID。

  • workflowExecutionDetail: イベントが出力されたときのワークフローの状態。

  • eventType: 履歴イベントタイプ。以下のいずれかを指定します。

    • ActivityTaskCanceled

    • ActivityTaskFailed

    • ActivityTaskTimedOut

    • WorkflowExecutionCanceled

    • WorkflowExecutionCompleted

    • WorkflowExecutionFailed

    • WorkflowExecutionStarted

    • WorkflowExecutionTerminated

    • WorkflowExecutionTimedOut

    • WorkflowExecutionContinuedAsNew

    • CancelTimerFailed

    • CancelWorkflowExecutionFailed

    • ChildWorkflowExecutionFailed

    • ChildWorkflowExecutionTimedOut

    • CompleteWorkflowExecutionFailed

    • ContinueAsNewWorkflowExecutionFailed

    • DecisionTaskTimedOut

    • FailWorkflowExecutionFailed

    • RecordMarkerFailed

    • RequestCancelActivityTaskFailed

    • RequestCancelExternalWorkflowExecutionFailed

    • ScheduleActivityTaskFailed

    • SignalExternalWorkflowExecutionFailed

    • StartActivityTaskFailed

    • StartChildWorkflowExecutionFailed

    • StartTimerFailed

    • TimerCanceled

    • LambdaFunctionFailed

    • LambdaFunctionTimedOut

    • StartLambdaFunctionFailed

    • ScheduleLambdaFunctionFailed

Amazon SWF イベントの例

以下は、Amazon SWF が EventBridge にイベントを送信する例です。

いずれの場合も、イベントデータの detail セクションに、DescribeWorkflowExecution API と同じ情報が含まれています。executionStatus フィールドは、イベントが送信されたときの実行の状態 (OPEN または CLOSED) を示します。

実行のスタート

{ "version": "0", "id": "444444444444", "detail-type": "Simple Workflow Execution State Change", "source": "aws.swf", "account": "444444444444", "time": "2020-05-08T15:57:38Z", "region": "us-east-1", "resources": [ "arn:aws:swf:us-east-1:444444444444:/domain/SimpleWorkflowUserSimulator" ], "detail": { "eventId": 1, "eventType": "WorkflowExecutionStarted", "workflowExecutionDetail": { "executionInfo": { "execution": { "workflowId": "123456789012", "runId": "AKIAIOSFODNN7EXAMPLE" }, "workflowType": { "name": "SimpleWorkflowUserSimulator", "version": "myWorkflow" }, "startTimestamp": 1588953458484, "closeTimestamp": null, "executionStatus": "OPEN", "closeStatus": null, "parent": null, "parentExecutionArn": null, "tagList": null, "cancelRequested": false }, "executionConfiguration": { "taskStartToCloseTimeout": "60", "executionStartToCloseTimeout": "1000", "taskList": { "name": "444444444444" }, "taskPriority": null, "childPolicy": "ABANDON", "lambdaRole": "arn:aws:iam::444444444444:role/BasicSWFLambdaExecution" }, "openCounts": { "openActivityTasks": 0, "openDecisionTasks": 1, "openTimers": 0, "openChildWorkflowExecutions": 0, "openLambdaFunctions": 0 }, "latestActivityTaskTimestamp": null, } } }

実行の完了

{ "version": "0", "id": "1111-2222-3333", "detail-type": "Simple Workflow Execution State Change", "source": "aws.swf", "account": "444455556666", "time": "2020-05-08T15:57:39Z", "region": "us-east-1", "resources": [ "arn:aws:swf:us-east-1:444455556666:/domain/SimpleWorkflowUserSimulator" ], "detail": { "eventId": 35, "eventType": "WorkflowExecutionCompleted", "workflowExecutionDetail": { "executionInfo": { "execution": { "workflowId": "1234-5678-9012", "runId": "777788889999" }, "workflowType": { "name": "SimpleWorkflowUserSimulator", "version": "myWorkflow" }, "startTimestamp": 1588953458820, "closeTimestamp": 1588953459448, "executionStatus": "CLOSED", "closeStatus": "COMPLETED", "parent": null, "parentExecutionArn": null, "tagList": null, "cancelRequested": false }, "executionConfiguration": { "taskStartToCloseTimeout": "60", "executionStartToCloseTimeout": "1000", "taskList": { "name": "1111-1111-1111" }, "taskPriority": null, "childPolicy": "ABANDON", "lambdaRole": "arn:aws:iam::444455556666:role/BasicSWFLambdaExecution" }, "openCounts": { "openActivityTasks": 0, "openDecisionTasks": 0, "openTimers": 0, "openChildWorkflowExecutions": 0, "openLambdaFunctions": 0 }, "latestActivityTaskTimestamp": 1588953459402, } } }

実行の失敗

{ "version": "0", "id": "1111-2222-3333", "detail-type": "Simple Workflow Execution State Change", "source": "aws.swf", "account": "444455556666", "time": "2020-05-08T15:57:38Z", "region": "us-east-1", "resources": [ "arn:aws:swf:us-east-1:444455556666:/domain/SimpleWorkflowUserSimulator" ], "detail": { "eventId": 11, "eventType": "WorkflowExecutionFailed", "workflowExecutionDetail": { "executionInfo": { "execution": { "workflowId": "1234-5678-9012", "runId": "777788889999" }, "workflowType": { "name": "SimpleWorkflowUserSimulator", "version": "myWorkflow" }, "startTimestamp": 1588953158481, "closeTimestamp": 1588953458560, "executionStatus": "CLOSED", "closeStatus": "FAILED", "parent": null, "parentExecutionArn": null, "tagList": null, "cancelRequested": false }, "executionConfiguration": { "taskStartToCloseTimeout": "60", "executionStartToCloseTimeout": "1000", "taskList": { "name": "1111-1111-1111" }, "taskPriority": null, "childPolicy": "ABANDON", "lambdaRole": "arn:aws:iam::444455556666:role/BasicSWFLambdaExecution" }, "openCounts": { "openActivityTasks": 0, "openDecisionTasks": 0, "openTimers": 0, "openChildWorkflowExecutions": 0, "openLambdaFunctions": 0 }, "latestActivityTaskTimestamp": null, } } }

実行のタイムアウト

{ "version": "0", "id": "1111-2222-3333", "detail-type": "Simple Workflow Execution State Change", "source": "aws.swf", "account": "444455556666", "time": "2020-05-05T17:26:30Z", "region": "us-east-1", "resources": [ "arn:aws:swf:us-east-1:444455556666:/domain/SimpleWorkflowUserSimulator" ], "detail": { "eventId": 6, "eventType": "WorkflowExecutionTimedOut", "workflowExecutionDetail": { "executionInfo": { "execution": { "workflowId": "1234-5678-9012", "runId": "777788889999" }, "workflowType": { "name": "SimpleWorkflowUserSimulator", "version": "myWorkflow" }, "startTimestamp": 1588698073748, "closeTimestamp": 1588699590745, "executionStatus": "CLOSED", "closeStatus": "TIMED_OUT", "parent": null, "parentExecutionArn": null, "tagList": null, "cancelRequested": false }, "executionConfiguration": { "taskStartToCloseTimeout": "60", "executionStartToCloseTimeout": "1000", "taskList": { "name": "1111-1111-1111" }, "taskPriority": null, "childPolicy": "ABANDON", "lambdaRole": "arn:aws:iam::444455556666:role/BasicSWFLambdaExecution" }, "openCounts": { "openActivityTasks": 1, "openDecisionTasks": 0, "openTimers": 0, "openChildWorkflowExecutions": 0, "openLambdaFunctions": 0 }, "latestActivityTaskTimestamp": 1588699585802, } } }

実行の終了

{ "version": "0", "id": "1111-2222-3333", "detail-type": "Simple Workflow Execution State Change", "source": "aws.swf", "account": "444455556666", "time": "2020-05-08T22:37:26Z", "region": "us-east-1", "resources": [ "arn:aws:swf:us-east-1:444455556666:/domain/canary" ], "detail": { "eventId": 48, "eventType": "WorkflowExecutionTerminated", "workflowExecutionDetail": { "executionInfo": { "execution": { "workflowId": "1234-5678-9012", "runId": "777788889999" }, "workflowType": { "name": "1111-1111-1111", "version": "1.3" }, "startTimestamp": 1588977445279, "closeTimestamp": 1588977446062, "executionStatus": "CLOSED", "closeStatus": "TERMINATED", "parent": null, "parentExecutionArn": null, "tagList": null, "cancelRequested": false }, "executionConfiguration": { "taskStartToCloseTimeout": "60", "executionStartToCloseTimeout": "120", "taskList": { "name": "1111-1111-1111-2222-2222-2222" }, "taskPriority": null, "childPolicy": "TERMINATE", "lambdaRole": null }, "openCounts": { "openActivityTasks": 0, "openDecisionTasks": 1, "openTimers": 0, "openChildWorkflowExecutions": 0, "openLambdaFunctions": 0 }, "latestActivityTaskTimestamp": 1588977445882, } } }