How to Handle Synchronization Issues When Using Task Queue for After Commit Event in Mendix?

0
I have some questions about the execution sequence of event handlers on the same entity in Mendix. In one scenario, I added an After Commit event handler (ACo) on entity A, which updates a counter on another entity B. To improve performance, I want this ACo to be executed in a task queue, allowing multiple threads to update entity B in parallel. However, this approach introduces a synchronization issue because multiple threads may read and write to entity B simultaneously, potentially causing errors. Is there a better way to resolve this or has someone encountered similar issues? I think the best solution is to add some read locks to the entity but menix does not support this by native.
asked
1 answers
1

1. Create a sub microflow the updates the count.

2. Call this microflow in a task queue, where it has only 1 thread per node. So that  simultaneous requests for updates would be added to queue and processed one after another, in background.

 

Make sure you handles the automatic retry properly. 

 

answered