How can I ensure a business rule runs in a "single threaded" manner?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2015 08:13 AM
I have a situation where I have many records hitting a table at once. There is however an order, and the auto number field gets the order right.
It's important that the first record is processed completely by the business rule, before the second record begins processing.
The issue I have is it seems that in Eureka if multiple records hit the table in rapid succession, they are processed at the same time. So records 1-4 are processed at the exact same time, which doesn't help me.
I've tried experimenting with writing "lock" type records into a temporary table, but this has proven unreliable since all of the threads go and write the lock file at the same time.
Any ideas on how I can force a business rule rule to run in a single threaded, ordered mode? Can be before or after type, doesn't necessarily matter for my purpose.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2015 10:39 AM
I think it really is going to depend on what exactly the rule is going to do. But off the top of my head how about having a job or asyc rule run and process the records in order you desire. All you would need is a field that indicates if they are processed or not.
Probably going to have to use a job as the more I think about it an async rule will have issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2015 08:34 AM
Hi Drew,
The job concept works, this is how I have it now. A periodically scheduled job seems to be the only thing I can find that will not run duplicate copies of itself. The challenge there is that it runs on a time basis, so unless I have it run every second, there is going to be a delay. I'm sort of weary about running a job that queries a table for new records at a shorter interval than 5-10 seconds.
So when a record hits the table, it may take 10 seconds for it to be processed. Was ideally looking for something that is sort of "triggered" vs. a "polling" mechanism. I tried triggering a job from a business rule, but when called from a script, jobs seem to loose their single threaded nature and behave just like the rules.
My experience with business rules....
- Async - waaaay out of order
- Before/After - "sort of" in order, if multi-threaded so if 4 records hit at exactly the same time they could be out of order
Was hoping for something simple. Like an attribute or property setting, or some sort of record locking mechanism I'm missing. May be wishful thinking.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2015 08:56 AM
One other thing you could try is have a BR create a run once job with a specific name and before creating that job you could look to see if it is there, if so you do not create it. This was you do not have to have to job running every 5 seconds.
Just a thought.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2015 03:09 PM
Hi Andy,
Business rule starts executing whenever a record is received, so it is difficult to run them sequentially.
However, you might be able to use 'Import Sets' for your use case, which performs action in sequential manner.
Have a look at this wiki link
-Thanks
Abhy