Hello,
I’d like to ask if there is a way / pattern of synchronizing signal method invocations.
In our use case, REST controller handles user responses. These are then signalled to a running workflow.
The issue is when a signalmethod would modify how the next signalmethod invocation should be handled (imagine only the first response is accepted, but the response has to be verified against external api called via activity).
For example:
-
acceptSignal
is handled, invokingsomeActivityMethod
-> schedulingsomeActivityTask1
- another
acceptSignal
is handled -> schedulingsomeActivityTask2
. -
someActivityTask1
starts and completes (calling external api and modifying workflow state) -
someActivityTask2
starts and completes (calling external api…)
We would ideally want to wait for someActivityTask1
(and any other tasks scheduled in the signal method) to finish before entering the @SignalMethod
again, calling the someActivityMethod
and scheduling someActivityTask2
.
Is this a valid case?
Should we somehow utilize the WorkflowQueue
or is there a different pattern for accomplishing this with workflows only, without utilizing some external synchronization?
Thank you
edit: I feel like I might be asking similar thing to what has been answered here: Limit workflow-based concurrent executions? so I will explore the linked repository, although I am already signalling this workflow so this is where I would like to buffer the activity executions.