Suppose there are 6 bots running in multi bot architecture
In the end state any one bot will generate the report
How to achieve this scenario?
I know that by using an asset and acquiring a lock
Also if the lock is acquired how to wait for the in progess items to get completed and then start generating the report
before acquiring lock you have to first check for new and in progress items usign get queue items and take the count…if count is 0 only then proceed for acquiring
cheers
With the help of locking mechanism you can achieve the desired report.
- Initialize Lock Asset: Create an asset named “lock” in Orchestrator. In the initialization state, set the value of this asset to “NA”.
- Check Queue Items: In the end process state, retrieve queue items with the statuses “New” or “In Progress”. Use a condition to check if the count of these queue items (QueueItems.count) is greater than 0.
- Acquire Lock: If there are queue items, attempt to acquire the lock. Check if the lock asset’s value (strlock) equals “NA”. If it does, set the lock asset’s value to Environment.UserName (the current bot’s username).
- Check Lock Ownership: Verify if the lock ownership matches the current bot’s username. If it does, proceed to create the report.
- Create Report: If the lock is successfully acquired, create the report (use your “create report” XAML). If the lock is not acquired, do nothing, ensuring only one bot creates the report at a time.
Suppose the other 5 bots are processing items
So the status of those 5 items will be in progress
The first bot is in end state
How the mechanism will work ahen the first bot will wait for all the in progress items to get complete and then generate the report
No first bot will see other bots are running and will end the process and stop…when the last bot comes in that will see that no items are in queue so it acquired the lock…for example if two bots come at one time if both see no in progress then one of it only can acquire lock after checkign queue items and only that will process report…all the bots before that will end without doing anything…they wont wait
cheers
Woow
How to check whether other bots are rinning or not?