I have a workflow definition attached.
I created it using modeler tool. I have added an intermediate catch(vehicle-exit) event with a correlation key vehicleId(this is a process variable that is inserted in process instance when process starts). I observe that modeler has added similar correlation key for message start event too. Is this correct behaviour from modeler?
Also, following is my java code to publish message for intermediate event. i want it to be published only when message send from a sensor is of certain type(âvehicle-exitâ)
if(message.getMessageType().equals("vehicle-exit")) {
var event = zeebeClient.newPublishMessageCommand()
.messageName("Message_1pukpc7")
.correlationKey(message.getVehicleId())
.send()
.join();
LOG.info("triggered a message event: {}", event.getMessageKey());
}
I observe that intermediate event doesnât get executed, and I see it continue waiting in /operate dashboard.
process-with-message-start.bpmn (7.7 KB)
Ok, got the reason why intermediate event keeps waiting. There were multiple processes in that state, and value for correlation key in all my messages was same. So my interpretation is that engine couldnât decide which one to send message to. Let me know if itâs wrong interpretation.
Not sure about first issue though, that why modeler implicitly adds correlation key for message start event too.
1 Like
Hi @mghildiy - I believe you are correct with your interpretation: message correlation should be 1-to-1, not 1-to-many, so that would fail. (Signals are what you need if you do want 1-to-many.)
As for the Modeler question, Iâm not quite sure what you mean? Can you elaborate? When you set the start element to be a message start event, you must define the message reference in the properties panel. While Modeler automatically generates a name, you have the ability to change it to something custom, but you donât set a value for it like you do with an intermediate message event. Check the âNoteâ on this page and let me know what other questions you have:
@nathan.loding, when I had only message start event in workflow, message corresponding to it was as:
<bpmn:message id="Message_2salc4n" name="Message_2salc4n" />
When I added intermediate message event with correlation key âvehicleIdâ, above message became:
<bpmn:message id="Message_2salc4n" name="Message_2salc4n">
<bpmn:extensionElements>
<zeebe:subscription correlationKey="=vehicleId" />
</bpmn:extensionElements>
</bpmn:message>
Modeler did it automatically. I am not sure of this behaviour.
@mghildiy - ah, I see what you mean now. Yes, that is the expected behavior. A message is a separate âentityâ within the process definition; the message is associated with an event (like the start and intermediate catch events) using its ID. When you added the intermediate message event, you used the same message and added a correlation key to it. The correlation key doesnât have an effect on the start event, but re-using the same message ID could have an effect on your process. In the properties panel for the intermediate message event, you can choose to define a new message (new ID and key) to prevent conflicts.
Does that help?
2 Likes
yes, that surely helps. Thanks a lot.
1 Like