Hello dear camundians,
I’m a bit confused about the treatment of messages on API level. For demonstration purposes, I have modeled two pools in my .bpmn, MAIN and EXTERNAL, both marked as executable. The first is started manually, the latter should be triggered by a message event (name: “extMessage”, defined on the .bpmn level).
Inside MAIN a message-send task (QueryTask) is supposed to send such a message “extMessage” with the process variables as payload. After reading the message API documentation, I have set up the starting of the process like this (rts is the RuntimeService):
rts.correlateMessage("extMessage" , "EXTERNAL"); ProcessInstance instance = rts.startProcessInstanceByKey("MAIN", vars);
Inside QueryTask::execute I set up the actual message emit like this:
Map<String, Object> vars = execution.getVariables(); ProcessInstance pi = rts.startProcessInstanceByMessage("extMessage", vars);
EDIT: Withdrawing the original question, seems to be an issue with eclipse and tomcat server integration; New question below:
I observe a behavior I do not understand: Before the call to start MAIN is executed, EXTERNAL is already executed by the correlateMessage statement. After that, MAIN is excuted. Is this the correct behavior? How should I set up my logic in order to execute MAIN and then EXTERNAL upon emitting the message in QueryTask?