Hey, I have particular requirement. There will be 2 processes say P1 & P2.
P1 will publish a Message event which will be listened by P2 at intermediate step.
If P2 hasn’t reached wait state to receive Message event while P1 has completed processing and ready to publish event.
P2 has to complete certain steps before it’s ready to listen to Message event.
How can I solve this scenario in order that Message event is published by P1 and it has to be consumed when P2 reaches wait state?
In P2 you coukd have a non interrupting message driven subprocess which sets a condition to true, ie P1 message received. If this is true, no need to wait for P1 message to arrive…
This is one pattern, other plugins exist to store messages for delivery…
As per the requirements there are possibilities that multiple instances of P2 can be running, as P2 is a sub process.
I would like all P2 running instances to receive the event published by P1.
When I tried as per the diagram above, getting error as there are multiple correlations matching.
I am trying the same -
runtimeService.createMessageCorrelation(“topic”).processInstanceBusinessKey(execution.getProcessBusinessKey()).correlateWithResult()
this throws error when multiple instances of P2 are running.
Please correct if anything missing.
the business key which is apparently the same as the parent key
To this method you can also a variable that you expect will exist for a specific instance of the process. without more information about your process i can’t really make a suggestion.
Thank you.
Actually I want to understand can multiple processes receive same message event?
In my case when 2 instances of P2 are running, while P1 tries to publish event I am getting an error stating cannot correlate as multiple instances running. I can look to share the exact error message.