Execution Listener cannot access local variables set by message boundary event

Execution Listener cannot access local variables set on message boundary event .

I correlates a message to M1, and its end listener can access local variable set in message.

But when I correlates a message to M2, the end listener of M2 cannot access local variables set in message.

Is there anything I’m doing wrong?

POST /message
{
  "messageName": "Message_2ri81fq",
  "processVariablesLocal": {
    "x": {
      "value": "aNewValue",
      "type": "String"
    }
  }
}

response: 
{
  "type": "ProcessEngineException",
  "message": "Unknown property used in expression: ${execution.setVariable(\"a2\", x)}. Cause: Cannot resolve identifier 'x'"
}


Process_test_variable.bpmn (6.3 KB)

Hi @moonheart,

I don’t think attaching boundary message event to receive task is a good practice.
I suggest you to use event-based gateway instead as in below model.

image

https://docs.camunda.org/manual/7.16/reference/bpmn20/gateways/event-based-gateway/

Receive Tasks after an event-based Gateway are not supported by the engine yet.

And I may attach non-interrupting events on M1, do you have any idea?

1 Like

Hi @moonheart,

Then you can replace receive tasks with message intermediate catching event.

Hi @moonheart,

so your model can be as below

image

1 Like