I have an SQL job that activates thousands of instances of the same workflow, using
ACTIVATE_UC_OBJECT. The SQL job’s post-process starts one instance of the target workflow for each row returned by the query; it passes some of the fields returned by the query as input parameters to the activated workflows. (It uses
:PUT_PROMPT_BUFFER to pass these values.)
Two of the fields that are passed to the target workflow are called
server_name and
node_name. I need to limit the number of workflows that are running simultaneously, based on these fields:
- Based onserver_name: only 100 workflows may run simultaneously for any givenserver_name.
- Based onnode_name: only one workflow may run at any given time for any givennode_name.
There are only a few different values for
server_name, so I could conceivably create SYNC objects for these, and assign them at runtime using
:ATTACH_SYNC. So at least the first case seems relatively straightforward.
However, there are several thousand different values of
node_name, and new values may appear in the DB table without notice. So it would be difficult to use SYNC objects for the second case. The activated workflows are assigned aliases that include
server_name and
node_name. So I thought it might be possible to use the
Tasks running in parallel option to limit the number of tasks having a particular name. However, I discovered that this option enforces the limit based on the
object name and not the
task alias. So unfortunately, this won’t work either.
Does anyone have any other ideas?