Problem with Message: Cannot correlate message

Hey, I know there are a few people here who have had similar problems, but I still get stuck.

i got this error message:

Cannot correlate message ‘sendeInfo’: No process definition or execution matches the parameters
org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot correlate message ‘sendeInfo’: No process definition or execution matches the parameters

Everything works fine. But the last message to show the information is not working.

I dont know what to do. I readed the thing with asynchronous, but it doesent work for me.
Do I have to set something for the other messages ( in the picture it is not checked, but i tried it)?

I start with:

	public void execute(DelegateExecution execution) throws Exception {
		final Map<String, Object> data = new HashMap<>();
		data.put("WORKERS", Variables.objectValue(execution.getVariable("WORKERS"))
				.serializationDataFormat(Variables.SerializationDataFormats.JSON).create());
		data.put("BUSINESS_KEY", execution.getVariable("BUSINESS_KEY"));
		final RuntimeService service = execution.getProcessEngineServices().getRuntimeService();
		service.startProcessInstanceByMessage("Sende Mitarbeiterdaten", data);
	}

Second Message is:

    final Map<String, Object> data = new HashMap<>();
        data.put("WORKER_ID", execution.getVariable("WORKER_ID"));
        data.put("START_DATE", execution.getVariable("START_DATE"));
        System.out.println(execution.getVariable("WORKER_ID"));
        System.out.println(execution.getVariable("START_DATE"));
        data.put("END_DATE", execution.getVariable("END_DATE"));
        final String key = (String) execution.getVariable("BUSINESS_KEY");
        final RuntimeService service = execution.getProcessEngineServices().getRuntimeService();
        service.correlateMessage("Sende Urlaubsantrag", key, data);

And the one with the problem is:

        final Map<String, Object> infoData = new HashMap<>();
        infoData.put("WORKER_ID", execution.getVariable("WORKER_ID"));
        infoData.put("START_DATE", execution.getVariable("START_DATE"));
        infoData.put("END_DATE", execution.getVariable("END_DATE"));
        infoData.put("GENEHMIGUNG", execution.getVariable("GENEHMIGUNG"));
        final String key = (String) execution.getVariable("BUSINESS_KEY");

        final RuntimeService service2 = execution.getProcessEngineServices().getRuntimeService();
        service2.correlateMessage("sendeInfo", key,infoData);

79 / 5000

I can only upload one picture so I don’t know if you can see it.

I hope someone can help me.

Do you have the second message as another start event in the same process diagram?

I dont’t think that will work. You need to put it in another diagram I believe.

i don’t think so. You can open the image in another tab and zoom in. The first receive is a message start event. The second and third messages are Message Catch events.

I do not quite understand why are you trying to communicate via messages in same process definition.

Well other than that, check that

a) Your business keys are unique. If you have several waiting for same message with same key, correlation cannot happen.

b) check that your message name does not have trailing spaces in the catch event (I have done that mistake a few times)

Thanks for the fast reply. My messages communicate between 2 pools. I start in the pool with the ERP-System lane ( Service Task). Then i send it to the worker pool for human task. After this ( second message) i send it back to the ERP-System to do multiple JAVA functions. And my last step ( the one with the problem) is to send the finished data back to the worker, to show the info.

a) So do I have to generate a new business key for the third message? I never learned it in college. We only got a small simple tutorial and with it we have to solve the task.

No you don’t have to generate a new business-key for each message.

But you can not have two instances waiting for same message name with same business key.

I went thru the images again and I think I got it now.

You are not commiting the status before sending the 3rd message, therefore the other process is not listening for it.

Try adding asynchronous after to the catch message event for ‘Sende Urlaubsantrag’.

Then it should respond to other process, which will then progress to listening to the last message…

Ah ok. So after i send my first message and start the message start event, the catach event in the ERP-System ( second message) and the catch event for the info ( third message) waiting for the same message with the same business key. or did I misunderstand you?

i will try it :slight_smile:

No,

when your upper process sends the ‘Sende Urlaubsantrag’ message, it waits for that transaction to end before moving forwards.

And that transaction does not end with service tasks unless you use async after somewhere.

When your lower process reaches async after or async before, it commits, and only the the upper process moves on.

If nothing commits the lower process before it sends the ‘sende info’ message, the upper process will not be listening to that message.

Ok i see. I tried it, but it is not working. I added the asynchronous after to the catch event of “Sende Urlaubsantrag”, but the error message is the same. Do i need to do the same for the xor-gateways in a lane?

No it shoudl not make a difference.

We are back to evaluating whther you have multiple ionstances running with same business key. Have you checked that yet?

I don’t think so. My business key is unique and is generated with a class.
When I start the process, a unique key is generated. What do you mean by multiple instances? I only have one start message and the 2 CorrelateMessages. When I send the message, I get the business key with Execution.getVariable.
I don’t think i build multiple instances within the proces.

Just making sure about possibility of duplicate keys.

Have your checked your message name for “sendeInfo” message definition in BPMN yet. really easy to get a trailing space there and not notice it.

If you are sending “sendeInfo” message and process is expecting "sendeInfo " it will not correlate. I have done that mistake a few times and its painful to spot.