indeedeng / iwf

iWF is a WorkflowAsCode microservice orchestration platform offering an orchestration coding framework and service for building resilient, fault-tolerant, scalable long-running processes
MIT License
519 stars 54 forks source link

V2 of waitForStateCompletion API using synchronous update feature #349

Open longquanzheng opened 1 year ago

longquanzheng commented 1 year ago

The current implementation uses a sub workflow: https://github.com/indeedeng/iwf/pull/345 requires to provide WaitingForCompletionStateExecutionIds on starting workflow which is cumbersome to use. It's required because we want minimize the initiation of these sub workflows as optimization.

Additionally, it's not efficient because of the overhead of starting/signaling another workflow. It consume quite a lot of actions

A better way is:

Note that continueAsNew need to be handled properly:

Also, it doesn't allow reuse workflowId for different executions, because of the RunID issues in Temporal. This v2 can solve the problems

Note that sync update feature is not prod ready in Temporal yet. We will start working on it when it is ready.

longquanzheng commented 2 months ago

Above solution is really complicated to implement, a better workaround is https://github.com/indeedeng/iwf/issues/404