How to send signal to particular instance of another flow?

I have two flows, the first one is waiting for a “stop” from the second. When I send the signal now, it works, however, I can potentially have multiple instances of the first flow. I only want to send the stop signal from the second to a particular instance of the first flow. So far I have not had any luck doing this in the modeler. I have set the executionId to the process ID of the first flow, but it stops all the running instances of the first flow. What do I need to do in order for the stop signal to be sent only to a single instance of the first flow? I see in the documentation that this can be achieved by setting the executionId but I can’t find an example of how to do that in the modeler.

Can you upload your model(s) and show what code you’re using to send the signal.
Also - if you use a message event instead of a signal it will only ever trigger one instance.

@iscariot_TF by adding the execution id to the query will signal the specific process instance.

runtimeService
 .createSignalEvent("signalName")
 .executionId(executionId)
 .setVariables(variables)
 .send();  
1 Like

Where do I put that code aravindhrs?

Here are the two.FlowA.bpmn (12.5 KB) FlowB.bpmn (4.0 KB)

I was under the impression that you could send a signal to a specific instance of a flow by specifying the executionId. Maybe I’m not using the right thing. I got that from here: https://docs.camunda.org/manual/7.12/reference/bpmn20/events/signal-events/

Hello @aravindhrs, @iscariot_TF.

Pay attention when using signal events instead of message events…
It’s dengerous if someone send a signal without specifiing a process instance.

A best practice, when you want to “signal” one process, is to use message events.

Hope it helps.

Thanks I will keep that under advisement. I have noticed something though, the flow that is awaiting the event acts like it is finished, it returns data to postman, despite the flow not being finished as it is waiting for a signal. How do I prevent this from happening so that it only sends data back to postman once the return signal is caught?