Count Number of Active Sessions
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
13-12-17 02:07 PM
I have multiple resources running the same process and want to be able to use a decision in the process depending on the number of active sessions.
Is there a way (maybe through custom code) to count how many sessions of a particular process are running in the control room?
This way I can use a decision on the number to send the process flow down a different route depending on the number.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
13-12-17 03:05 PM
I'm afraid there is no easy option. In theory you could just query the DB, but that would break your security model. You could make the process record its presence by adding an item to a queue and then locking it. If the process failed, the item would get the exception 'Automatically set at cleanup', if the process completes, then it can just mark the item as complete. To answer the 'how many of me are there?' the process could count the number of locked items. To avoid the chance that the count is made at the exact moment between adding and locking an item, you could use an environment lock to ensure 'one at a time' access to the queue.
I totally accept this is way too much work for something that should be easy!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
13-12-17 03:51 PM
I have spoken to a colleague and decided that we will create an Excel file at the start of the process - when it gets to the point when we need to know the number of sessions running a count will be taken of the files in a folder to determine the number.
As each session ends the file will be deleted.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
13-12-17 06:23 PM
Yes that could work. Just consider the possibility of process terminating and mot getting chance to delete the file. That's why I suggested a queue item, because it will automatically be marked as an exception.
