Is there a simple way to queue / delay inbound messages in camunda?
We have a problem regarding messages that are sent to the REST API.
In problem case, a legacy system sends us two messages. First message initiates the process and second message contains an event that must be correlated to the correct process instance. Correlation keys are in the first message.
Problem happens when the initiating system sends the two messages with very small delay. If opur engine is under load, we have not processed the first message when the second arrives and we get an error message:
"@timestamp":"2021-10-11T05:56:23.272Z", "log.level":"ERROR", "message":"ENGINE-16004 Exception while closing command context: Cannot correlate message 'closeEvent': No process definition or execution matches the parameters", "service.name":"process-engine","process.thread.name":"http-nio-8080-exec-10","log.logger":"org.camunda.bpm.engine.context","transaction.id":"3XBrkaoK","trace.id":"Hwi8ZqAV","labels.TRACE_ID":"Hwi8ZqAV","error.type":"org.camunda.bpm.engine.MismatchingMessageCorrelationException","error.message":"Cannot correlate message 'closeEvent': No process definition or execution matches the parameters","error.stack_trace":"org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot correlate message 'closeEvent': No process definition or execution matches the parameters\n\tat org.camunda.bpm.engine.impl.cmd.CorrelateMessageCmd.execute(CorrelateMessageCmd.java:88)\n\tat org.camunda.bpm.engine.impl.cmd.CorrelateMessageCmd.execute(CorrelateMessageCmd.java:42)\n\tat org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28)\n\tat
Simple way to fix this would be if we could set the engine to try the correlation with delay for like 3 times. Is there a way to do this?
Wew would prefer not to touch the initiating system as its legacy.