Modifiche allo stato di esecuzione di EventBridge per Amazon SWF - Amazon Simple Workflow Service

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Modifiche allo stato di esecuzione di EventBridge per Amazon SWF

Utilizzi Amazon EventBridge per rispondere alle modifiche dello stato o agli eventi in unAWSrisorsa. Quando Amazon SWF emette un evento, passa sempre al bus di eventi EventBridge predefinito per il tuo account. È possibile creare una regola per gli eventi, associarla al bus eventi predefinito e specificare un'azione di destinazione da eseguire quando EventBridge riceve un evento corrispondente alla regola. In questo modo, è possibile monitorare i flussi di lavoro senza la necessità di eseguire il polling costantemente utilizzandoGetWorkflowExecutionHistoryAPI. In base alle modifiche apportate alle esecuzioni del flusso di lavoro, è possibile utilizzare una destinazione EventBridge per chiamareAWS Lambdafunzioni, pubblicare messaggi negli argomenti Amazon Simple Notification Service (Amazon SNS) e altro ancora.

È possibile visualizzare il contenuto completo di un evento di modifica dello stato di esecuzione utilizzandoDescribeWorkflowExecution.

Per ulteriori informazioni, consulta la Guida per l'utente di Amazon EventBridge.

Eventi EventBridge

I tipi di eventi della cronologia contengono le modifiche allo stato di esecuzione. Ladetailla sezione di ogni evento contiene almeno i seguenti parametri:

  • eventId: l'ID evento mostrato da GetWorkflowExecutionHistory.

  • workflowExecutionDetail: lo stato del flusso di lavoro quando è stato emesso l'evento.

  • eventType: il tipo di evento della cronologia, una delle seguenti opzioni:

    • 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

Esempi di eventi Amazon SWF

Di seguito sono riportati esempi di eventi Amazon SWF che invia a EventBridge:

In ogni caso, la sezione detail in caso di dati fornisce le stesse informazioni dell’API DescribeWorkflowExecution. LaexecutionStatuscampo indica lo stato dell'esecuzione nel momento in cui l'evento è stato inviato,OPENoCLOSED.

Esecuzione avviata

{ "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, } } }

Completata l'esecuzione

{ "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, } } }

Esecuzione non

{ "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, } } }

Esecuzione scaduta

{ "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, } } }

Esecuzione terminata

{ "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, } } }