Hi,
I am sending a message to start the subprocess with an interrupted message start event but without success. I always have exceptions: Cannot correlate message: No process definition or execution matches the parameters. The process instance is correct as well as the message name. The code snippet is as follows:
// correlate the message
MessageCorrelationResult result = runtimeService.createMessageCorrelation("messageName")
.processInstanceBusinessKey("AB-123")
.setVariable("payment_type", "creditCard")
.correlateWithResult();
This error occurs when camunda cannot find anything that correlates with what was requested… for example, the business key entered may not exist, the messageName entered may not exist, the instance in which the correlation attempt was made may not exist. be more within the necessary scope, among other reasons…
Maybe if you could share your process model with us, we can help you in a better way!
Thank you for your fast response. I really appreciate it. The BPMN diagram is pretty complex for uploading. Therefore, I found a potential problem in my application. The execution stops at another subprocess, actually on a user task in another subprocess. Maybe that is the reason why I am getting this exception when I send the message. Is it the reason why the message could not be sent?
If your instance stopped in another subprocess and this subprocess is not in the same scope as your message event, it is undoubtedly for this reason.
For a correlate to happen, it requires validation of 2 correlations… and in this case the correlations are your “businessKey” and your “messageName”… if the message event with this message name is in a scope, and its instance with this businesskey is in another scope, it will not be able to correlate.
If your instance with this businessKey is in task “C”, and the correlate is triggered… it will correlate correctly…
If your instance with this buisnessKey is already outside the scope of the subprocess where the message boundary event is located, that is, if it is already in task “D” or “E”… the message will not be correlated.
NOTE.: I created this process quickly just to exemplify my explanation, so ignore details please… hehehehe