I found that jbpm supports correlation keys to look up processes (section "5.3.3. Correlation Keys" in documentation). Correlation keys could be used to find the target process id for a message or a signal and use it in signalEvent(String type, Object event, long processInstanceId).
Are correlation keys supported by kie-workbench?
I could not find a way to assign a correlation key to a process when starting it from workbench.
Did you figure this out, how to send the signal to only some specific process instances? I'm faced with the same challenge.
The sender must know the process id of receiver.
It can be done via user interface as it is the case in workbench. The user selects the process to send the message to.
The alternative is to do it programatically. The receiver needs to register with a registry based on some key. The sender would know the key and would be able to look up for target process id.
There is nothing off the shelf to help on programatically way.
Thanks for your reply and for helping. I'm pretty new to jBPM and may be going about this the wrong way, but I have 2 process definitions, say A and B. Instances of B are created after an A instance and the instances of B also maintain a process variable that is more or less the ID of the A that they "relate" to. Then i want, say, a specific instance of A to signal all the relevant instances of B. I assumed there'd be a way to query then iterate over all of the B instances and signal just the ones that have the right ID.
Not sure if this is making sense. I think the crux of my issue is how to iterate over all of the active process instances - I'm only using the kie workbench. I'm not necessarily expecting you to know the answer and from what you've said maybe it isn't possible (without a custom registry), but just spelling this out in case anyone can help. I have been trying to find some code that i could perhaps use in a script task within process A to do this.