Cannot correlate messsage

Hello everybody. I am new in Camunda. Periodically, an error appears in the event marked in the screenshot. Please any help, thanks!

code:

ProcessEngines.getDefaultProcessEngine()
.getRuntimeService()
.createMessageCorrelation(String.format("%s_%s", JmsMessageType.APPLICATION_ACTION.name(), action.name()))
.processInstanceBusinessKey(applicationNumber)
.correlate();

org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot correlate message ‘APPLICATION_ACTION_ACT_ACCEPT_APPLICATION’: No process definition or execution matches the parameters org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:122) org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:77) org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736) org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696)

Hello,

I think I need to get some more details in order to understand it better. Where do you try to run the code? Are you trying to send it from the same process?

Second think it would be helpful if you could format your post, so it is easier to read the code and quicker and easier to understand :wink: So I assume other people will be more likely to look at it and help.

Something like this helps:

 ProcessEngines.getDefaultProcessEngine()
.getRuntimeService()
.createMessageCorrelation(String.format("%s_%s", JmsMessageType.APPLICATION_ACTION.name(), action.name()))
.processInstanceBusinessKey(applicationNumber)
.correlate();

thanks for your reply and advice about formatting. It is on production server. IntermediateCatchEvent_0is05jf calls the above code. Other events before the IntermediateCatchEvent_0is05jf are successful. I am trying to send it from the same process

@devkz Within the same process scope, correlation of message event is not supported.

1 Like

thanks for link. But it works for me in most cases. Is this how it should work? Sorry if the question is too simple

You might be encountering a classic “race condition” here … camunda will only be able to correlate messages to a process once an eventSubscription has been persisted in the database. If you working synchronously, it can be the case that your send/receive cycle is to fast and you cannot receive the message because camunda has no chance to learn that it is waiting for a message.
One (relativly) simple approach could be to work with asynchronous continuation (the “async” checkboxes in the modeler), since these force camunda to commit the current execution … but when it comes to “real time” and “race conditions” … you can just minimize the risk, seldom completely avoid the issue. My colleague Simon wrote a 2 part blog post on orchestration patterns, which could be of help.

1 Like