That's pretty advanced stuff to express in a microflow, but what if you would have 1 container microflow that is set to disallow concurrent execution and that executes these various microflows for you, picking a specific microflow based on a configuration parameter/entity for example?
use the queue module from the appstore?
You can not achieve this by using objects because the way microflows are exectuted is not the sequential as you would expect. Simplified: a set of database queries is created and executed at one moment in time.
You can achieve this by using locks as provided in the community commons module. With a lock you get can unique access to data and preventing others to change that data until you are finished.
You could use the community commons locking functionality: at server startup, you create a single object, say IsBeingExecuted. Then, when you start one of the three microflows, you use the AcquireLock on that object. When you microflow is finished, you release the lock.
You may need to edit the locking functionality: I believe that locking checks if the user that is requesting the lock is the user that has the lock. This would mean that a single user can execute all three microflows. You would have to edit the functionality so that whenever the IsBeingExecuted object is locked, it doesn't matter which user has the lock, it will always return false.
Currently, the insert / commit / delete approach works similar to the "lock" approach, I see that M2 does not start until M1 is finished, and starts afterwards. Without the lock, M2 would have started, and exited the branch - because "goAhead" would be false. But my intent was to avoid this, because it's easy (for future developers ;) ) to make a mistake and possibly create a deadlock.
Having a container microflow is a good solution - except when the triggers are in the UI, which makes it a bit complex to pass parameters to the container guy: M1UIButton --> calls dummy_M1 --> calls container (with param=M1) --> calls M1.
I will checkout the queue app.
Mendix does not have optimistic or pessimistic concurrency control.
For some application or batch process, queuing is not enough.
Mendix does not support optimistic or pessimistic concurrency control.
For some application or batch process, queuing is not enough.