Does Alfresco execute rules sequentially or concurrently?

cancel
Showing results for 
Search instead for 
Did you mean: 
robl
Active Member II

Does Alfresco execute rules sequentially or concurrently?

Jump to solution

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?

1 Solution

Accepted Solutions
afaust
Master

Re: Does Alfresco execute rules sequentially or concurrently?

Jump to solution

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).

View solution in original post

2 Replies
afaust
Master

Re: Does Alfresco execute rules sequentially or concurrently?

Jump to solution

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).

robl
Active Member II

Re: Does Alfresco execute rules sequentially or concurrently?

Jump to solution

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.