Does Disallow concurrent execution work while Horizontal Scaling?

0
Dear all,    In our app we know a concept of eventMessage. Which we need to process in order, and often contain status updated from other systems.   For processing eventMessages we have a scheduled event running that picks up the next queued eventMessage and processes all queued messages until the queue is empty. The Scheduled event is setup to 'skip next'. Scheduled events in Mendix are only run once per cluster. This ensures that when we are scaling or Mendix app horizontally (Running multiple versions of the app next to each other to increase reliability and performance), this process runs only once.   Now we have a new requirement, some eventMessages need to be processed in the background and we halt other messages until these are finished. We do not want to wait the full minute until the Scheduled Event checks again for queued messages.    So I am looking for solutions to ensure that we can both trigger the ProcessNext Microflow from Scheduled Event, and from logic in the app. But still ensuring it only runs once.    Adding a task a task queue which is set to only run once cluster-wide solves the issue. But this could result in us adding our microflow to the task queue more times than needed, which I would like to avoid.   The 'disallow concurrent execution' property of Microflows seems to be a good solution for this. But does anyone knows if this also prevents other nodes from executing the Microflow?
asked
1 answers
0

The answer to this question can be found here: Clustered Mendix Runtime | Mendix Documentation

 

It basically states that your desired option is not available for clustered deployments.

 

In addition, whilst the the "Disallow Concurrent Execution" toggle on microflows can be useful,  I personally find them to be less reliable than queuing microflows through taskqueues due to a couple of factors:

  • Queues, when specified for one process per cluster, will ensure that processing of activities always occurs sequentially directly after each other for a list of activities without needing a scheduled event that has a minimum frequency of one minute;
  • Error-handling in microflows that have their "Disallow Concurrent Execution" setting activitated and are executed from a client-action is tricky, since you are limited to two options: message or microflow, with the latter being limited in its functionality and being prone to throwing generic error messages (see: https://community.mendix.com/link/space/microflows/questions/132718);

There are some disadvantages though:

  • You will still need a scheduled event if you want to control the order in which event messages are added to the task queue, since you will only want to queue a new eventMessage from the scheduled event if the queue is empty;
  • You will need to handle the asynchronousity of the task queue in your user interface, if showing output immediately after completion is a requirement. Consider the microflow timer widget or the new push notification support for PWA's as a possible solution for this.

Hopefully this will help you in making your decision.

answered