08-18-2018 09:39 AM
I'm working on a creating a scripted rule for a folder that should update a counter (integer) property defined on an aspect associated with the folder.
The idea is that someone drops a file/document into the folder, some business logic runs then the document is moved to another folder. The final steps read the current value of the "counter", increments that value by 1, then saves the value.
Is there a way to ensure that if 2 or more documents are dropped into the folder at the same time that the counter is updated correctly? If Alfresco is running the rule for each of the dropped documents concurrently, is it possible that they obtain the same current value of the counter and then increment it, causing the counter to have the wrong value?
08-20-2018 09:23 AM
As long as you do not specify that your rule(s) run "in the background", then the rule(s) will be run sequentially (in the order they are triggered, not the order they are listed in the "Manage Folder Rules" action). Any rule run in the background (asynchronously after commit) may run concurrently with other such rules (or may not - depending on how much load is on the system and if asynchronous processing threads are sufficiently available).
08-20-2018 09:23 AM
As long as you do not specify that your rule(s) run "in the background", then the rule(s) will be run sequentially (in the order they are triggered, not the order they are listed in the "Manage Folder Rules" action). Any rule run in the background (asynchronously after commit) may run concurrently with other such rules (or may not - depending on how much load is on the system and if asynchronous processing threads are sufficiently available).
08-20-2018 04:53 PM
Thanks Axel Faust. That answers my question.
The folder rule will help for the near future. I may try re-implementing this as a behavior for version 2 of this solution.
Explore our Alfresco products with the links below. Use labels to filter content by product module.