Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialise workflow task token manager #789

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexiswl
Copy link
Member

Use a WorkflowRunStateChangeSync event to run workflows 'within' an AWS Step Functions.

Service 1: TaskTokenManager

  1. Listens to any 'WorkflowRunStateChangeSync' event from the OrcaBus
  2. Splits the task token out from the event details and stores it in a DynamoDB table indexed by the portal run id
  3. Publishes a WorkflowRunStateChange event, with the task token removed

Service 2: Send Task Token Success Events

  1. Listens to any 'WorkflowRunStateChange' event with a terminal Status from the OrcaBus
  2. Looks up the portal run id in the DynamoDB table to get the task token (if it exists)
  3. Sends either a TaskTokenSuccess or TaskTokenFailure event

An attribute might look like this

{
  "EventBusName": "OrcaBusMain",
  "Source": "Whatever",
  "DetailType": "WorkflowRunStateChangeSync",
  "Detail": {
    "portalRunId": "...",
    "taskToken": "task token",
    ...
    "payload": {
      "data": {}
    }
  }
}

One can generate the detail from the source with the following AWS Step Functions Code

{
  "QueryLanguage": "JSONata",
  ...
  "States": {
    "Run Workflow": {
      "Type": "Task",
      "Resource": "arn:aws:states:::events:putEvents.waitForTaskToken",
      "Arguments": {
        "Entries": [
          {
            "Detail": "{% $merge(\n  [\n    {\n      \"taskToken\": $states.context.Task.Token\n    }, \n    $workflow_run_state_change_event_obj\n  ]\n) %}",
            "DetailType": "WorkflowRunStateChangeSync",
            "EventBusName": "OrcaBusMain",
            "Source": "Whatever"
          }
        ]
      },
      "Next": ...
    }
  }
}

@victorskl
Copy link
Member

Please on hold merge this PR until 0.3.0 release wrap up.

@victorskl victorskl removed the on hold label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants