Given that I initiated a workflow execution with workflowId 111, and later I started another workflow execution with workflowId 222 (workflow 111 is still running). Now, when I attempt to send a signal to workflow 111, the signal gets sent to the latest workflow execution, which is workflow 222. How can I address this issue? In other words, how can I specify the workflow ID to which I intend to send a signal?
I am using Temporal with Spring Boot.
Update: I have discovered a potential solution to this issue. Here is the code:
DemoWorkflow workflow = workflowClient.newWorkflowStub(DemoWorkflow.class, workflowId); // workflowClient is an injected spring bean
workflow.sendSignal();
I’m curious to know if this approach is recommended. Additionally, when using the newWorkflowStub
method, does it create a new instance of the workflow stub object each time, or is it like getWorkflowStub
in terms of object creation?