I would like to start process plan with a signal or message event. Now, I’m confused about
the modeler (v.0.6), because I can fill out the following fields: Id, Name, Message (Autocompleted),
Message Name and Initiator. If I add a message, a modeler Id will be append to the
message name (e.g. Message_3kpn6jo)
The API says I can use a correlation mechanism [1]:
// correlate the message
runtimeService.createMessageCorrelation(“messageName”)
.processInstanceBusinessKey(“AB-123”)
.setVariable(“payment_type”, “creditCard”)
.correlate();
What kind of message name is represented in this code snippet? Should I use ‘Message_3kpn6jo’
or only ‘Message’ to correlate the message in my code?
You have to use the message name, i.e. what you put into the “Message Name” field in the modeler. Note that you can manually change the message name to anything more meaningful.
if you create a message start event with the message name My Message the modeler will create a ID for it which is something like Message_XXXXXXX.
This ID is used to reference the message in the BPMN diagram. What it will generate in the XML is a message element and a message event definition in the start event which references this message element.
thank you for your replies.It answered my question.
However, I`m getting now an engine expection, which is some kind of progress.
I`ve tried to implement the message with following ways:
getRuntimeService()
.createMessageCorrelation("rfidTags")
.correlateAll();
// second try
getRuntimeService()
.correlateMessage("rfidTags");
Errors:
Exception while closing command context: Cannot correlate message rfidTags:
No process definition or execution matches the parameters
// and
RuntimeException during event dispatching: Cannot correlate message rfidTags:
No process definition or execution matches the parameters Re-throwing it.
So, the process cannot find the correlated message inside the process plan. Do I miss some configuration?
You can see my process plan in the attached picture. The XML looks like Sebastian described it.
If this query is performed by the delegate attached to the service task, then you are hitting a limitation of the engine. Read the following thread for details: