Message Correlation Error

Hi All,

We’ve been experiencing correlation errors on our process intermittently and I’ve been lurking around looking for answers for months now and I’ve decided to ask question here. I’ve got the basics and I know what’s happening but we still cannot solve the correlation issue.

Issue happens on this snippet:

        final List<MessageCorrelationResult> correlationResults = createCorrelationBuilder(SALES_ORDER_ACK_MESSAGE,
                                                                                           manifestNumber)
                .setVariables(salesOrderAckMapper.toProcessInstanceVariables(salesOrderAck))
                .correlateAllWithResult();

and the bpmn looks something like this:
image

Also, since this happens intermittently, any sure fire way to be able to recreate the issue in local machine?

Please help.

Thanks,
Carl

Hi @cvela,

This looks like something you’re doing on Camunda Platform 7?

It’s currently in the Camunda 8 topic. You’ll get better visibility if you move it to Camunda Platform 7, if that’s what you are using.

Josh

1 Like

When you say it’s not working correctly, can you give some more details. like an error message or describe what happens in the process?

Hi @Niall ,

Thanks for the reply. The error we’re intermittently getting is:

2022-07-15 08:50:47.259 ERROR 1 --- [http-nio-8080-exec-7] a.c.a.m.c.e.CustomRestExceptionHandler -- userName=anonymousUser, ip=10.215.74.21 -- : 7dc1486f-ea06-46f3-a0d7-a8903c8f6924
org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot uniquely correlate message 'LodgementEvent(manifestBusinessKey=485cae73-da91-4114-b0a1-8b0c0d00a75d, manifestNumber=PC0000000609, consignmentBusinessKey=109ee529-f8d0-4780-bd92-ce4531d09887, consignmentNumber=34XD40000231, lodgementCentreId=28317, workCentreCode=422748)', business key 'PC0000000609', matched processes [].
at [au.com]

I’ve added a check so it can “skip” the gateway above and it seems like it solved it then we saw it happened intermittently again and that hack did not solve the correlation issue.

image

Here’s the lifecycle, the sender is 1 and the receiver is 2 and token is stuck in 3. If it does not receive any message it will wait for x days and continue the lifecycle.

Thanks,
Carl

Pasting error message:

org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot uniquely correlate message ‘LodgementEvent(manifestBusinessKey=4edc0ac1-069b-49f8-afd9-38d29df5d907, manifestNumber=PC0000000712, consignmentBusinessKey=adea26ca-baca-4bfa-a7f4-70044a4631f8, consignmentNumber=34U8D0002447, lodgementCentreId=29493, workCentreCode=445763)’, business key ‘PC0000000712’, matched processes [].
at au.com.auspost.mps.service.ProcessInstanceIdParser.parse(ProcessInstanceIdParser.java:28)
at au.com.auspost.mps.service.ManifestLifecycleService.processLodgementEvent(ManifestLifecycleService.java:60)
at au.com.auspost.mps.web.controller.rest.ManifestLifecycleControllerV1.processLodgementEvent(ManifestLifecycleControllerV1.java:43)
at jdk.internal.reflect.GeneratedMethodAccessor520.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.security.saml.SAMLLogoutProcessingFilter.processLogout(SAMLLogoutProcessingFilter.java:209)
at org.springframework.security.saml.SAMLLogoutProcessingFilter.doFilter(SAMLLogoutProcessingFilter.java:107)

Throwing a message to be received in the same process is NOT a safe design.
Perhaps I misunderstood your diagram, but that’s what I think you’re trying to show.

The error message indicates that the engine wasn’t able to do a 1:1 correlation, and since it says “matched processes []”, my guess would be that it wasn’t able to find a process that was waiting for the message when the message was thrown. This makes sense, since it looks from your overall diagram that the message gets thrown (at 1) much earlier than your process wants to catch the message (at 2)

Try to refactor your process - eliminate the “send message to myself” configuration, and it will likely become much more stable.