In the UserTask Task 2.2 → TaskListener → Complete Event → Delegate Expression → Provide implementation to correlate the message with name “completeTask”.
In the messageSender listener provide the implementation like this:
delegateTask.getExecution().getProcessEngineServices().getRuntimeServices()
.createMessageCorrelation("completeTask")
.processInstanceBusinessKey("someOrderId")
.setVariable("CANCEL_REASON", "someReason")
.setVariable("CANCEL_TIMESTAMP", new Date())
.correlate();
In the ReceiveTask 1.2 → Message Name → configure the message name as “completeTask”.