Message Boundary event unable to update the variables in current process

Hi @bharat3,

This is a common issue with message boundary events in Camunda 8. The problem is likely related to how variables are handled differently between message tasks and message boundary events.

Root Cause Analysis

When you send a message using publishMessageCommand(), the variables should be merged into the process instance’s global scope by default. However, there are several potential causes why this might not be working:

1. Check Your BPMN Configuration

The most common cause is output mappings configured on the message boundary event. If you have output mappings defined, only the explicitly mapped variables will be updated in the process instance.

Solution:

  • Open your BPMN model in Camunda Modeler
  • Select the message boundary event
  • In the Properties Panel, check the Variable Mappings section
  • If you want ALL message variables to be merged into the process: remove any output mappings
  • If you want specific mappings: configure them explicitly (e.g., map sourceVar to targetVar)

2. Variable Scope Considerations

Message boundary events merge variables into the global process scope, not into local variables of the attached activity. This is different from message tasks.

3. Verify Your Code

Your code looks correct, but double-check that you’re using .variables(varMap) and not .payload():

zeebeClient.newPublishMessageCommand()
    .messageName("DormancyActivation")
    .correlationKey(correlationKey)
    .variables(varMap)  // ✅ Correct
    .send()
    .join();

Debugging Steps

  1. Check the BPMN model: Look at the message boundary event’s variable mappings
  2. Verify variable scope: Use Operate to check if variables appear in the global process scope
  3. Compare with working message task: Check if the message task has different variable mapping configuration

Quick Fix

Try removing any output mappings from your message boundary event in the BPMN model. This should allow all variables from varMap to be merged into the process instance.

Could you please share:

  1. The variable mapping configuration of your message boundary event (screenshot from Camunda Modeler would be helpful)
  2. Whether you can see the variables in Operate after the message is received
  3. Your Camunda 8 version

This will help me provide more specific guidance.

References: