Skip to content

Initialise workflow task token manager #789

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

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
@victorskl
Copy link
Member

Pending 1-1 dev catchup / discussion @reisingerf @alexiswl

@victorskl
Copy link
Member

We discussed this task token manager microservice today. Thanks Alexis for explain motivation behind implementing this service. Consensus was to give it ago by commissioning this service. We will/shall adjust when need, down the track.

Next actions;

  • Alexis pls make it PR ready when it is ready to review
  • We shall then review and, push it through; possibly with O4

@alexiswl @reisingerf

@victorskl
Copy link
Member

Aleixs @alexiswl - would you like to merge this anyway? Or, this has been superseded by elsewhere perhaps?

@alexiswl
Copy link
Member Author

Ah no this has been vetoed, for now...

@victorskl
Copy link
Member

Consider migrate this feature branch to new repo where appropriate or close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants