Yeah, I send signal events in the same process instance.
My workflow:
I have some global process, for example, car lottery. This process starts when manager push "Start Lottery" button. He can start many loterries simultaneously.
To participate in this lottery user should go throught several stages of registration, attend on lottery, take a price (big or small, little price gives to all participants), and so on. So this task need to be moved to separate subprocess.
My code & problem:
So, I don't know how many users will participate in lottery, I need to start subprocesses in for-loop:
<java>
//this handler proceed launching users's subprocesses for current lottery
public void handler(int loterryId, List<Integer> userIds) {
….
Map<String, Object> subprocessVars = null;
for (Integer userId : userIds) {
subprocessVars = new HashMap<String, Object>();
subprocessVars.put("lotteryId", lotteryId);
subprocessVars.put("vacancyId", vacancyId);
//PROBLEM: subprocessVars is written to global context, and if will be overriden by each subprocess!
runtimeService.signalEventReceived(signalName, executionId, subprocessVars);
}
}
</java>