I was trying to throw and catch a message while also running a count down timer, that terminates the process in case a message is not received within a certain time.
I therefore used a parallel gateway. I ran into some issues and wonder now, are the different branches running in parallel or randomly sequential?
In this process, my service task on the top throws a message, which the intermediate message catch event receives and successfully executes.The service task asks the user per command line, if a message should be thrown.
I then tried to introduce the timer as a thrid branch. However, the timer is never started. It never "runs into check if message received within time frame".
I then remodelled the process. Here, suddenly the intermediate catch event is never executed.
Are those parallel gateways executed sequentially or do they run in separate threads and are executed in parallel?
I know usually I would use an intermediate catch. However, I have to present my process to my boss next week and I have to show, how easily I can introduce change in a modeler to a process and execute it. So subprocesses and event based splits are not an option for this model.
There is only a single thread executing any single process instance. So when you do parallel gateways they will execute sequentially. I don't know the guts well enough to know anything about order.
Another way to reason about this would be to consider how many people could write thread safe scripts for their before and after actions. No offense to you non-programmer workflow creators. Making stuff thread safe is tough. Making systems as extensible and customizable as this thread safe is a nightmare.
Found that part in the documentation:
In general, the engine executes the process sequentially. For example, when the engine encounters a script task in a process, it will synchronously execute that script and wait for it to complete before continuing execution. Similarly, if a process encounters a parallel gateway, it will sequentially trigger each of the outgoing branches, one after the other. This is possible since execution is almost always instantaneous, meaning that it is extremely fast and almost produces no overhead. As a result, the user usually doesn't even notice this.
Ok, just to extend this thought.
I had a look at the evaluation example. Both mary and john receive human tasks in the tasklist at the same time.
Event though these tasks are triggered sequentially after each other. I guess that is possible, because the human task handlers are asynchonous.
But lets imagine the node on top would be an intermediate message receive event node and the one on the bottom a timer event node. If the receive node is entered first, the process would be waiting until a message comes and the timer would not be executed (until the message comes in). Vice versa, if the timer is entered first, the timer would be finished and then the receive node would be activated (and waiting).
I think I've seen the scenario you described in jpbm-examples JUnit test suite, test case BPMN2-EventBasedSplit2. The only difference is that JUnit sample uses undefined diverge gateway and your sample uses AND diverge gateway. Could you try with non-defined diverge gateway and see if it is going to work?
Hi, thanks for your help. I noticed the EventBasedSplit as well. Unfortunately Oryx did not like it and I tried to create a work around with And and XOR gateways. Tihomir fixed it by now, see here:
However, I was still interested how this strange behaviour came up. I mean, why the timer was never executed, while even if it was synchonous, the timer should have started after everything else was finished.