Hi I have a use case where a workflow A is supposed to execute child workflow B. However there might be a case where there is ongoing workflow B (same workflow ID), which in such case workflow A will see ChildWorkflowExecutionAlreadyStartedError.
Is there any prescribed way on how workflow A can retry to execute workflow B until it suceeds? In other words I want to “queue” this other workflow B execution so that it gets picked up after the ongoing one finished.
I would use SignalWithStart from an activity to start another workflow. If it is not running it is started, if it is running it is just signaled. The workflow implementation can buffer the signals and process them one by one.
hey thanks maxim
i think i got the idea, but i think i may explain the scenario wrongly. in this use case the ongoing workflow is different than workflow B although it has same workflow ID. so it’s something like
- workflow A execute workflow B
- workflow C (different workflow but it has same workflow ID with workflow B) is ongoing
- workflow B should be executed after workflow C
- there might be workflow D (also same workflow ID) waiting to be executed, but in this case workflow B should be running first and it’s fine for caller of workflow D to see already started error
we use same workflow ID because both B & C & D is modifying the same state and we kinda want to avoid using lock
is there other suggested approach given this scenario?
also is there any plan to make SignalWithStart available without wrapping it inside an activity?
I would create workflow E that is started using SignalWithStart and which executes A, B, C as children one by one.
i see, i think that works too