We need to run instances of a particular activity/child process, in parallel. The number of instances has to be dynamic (based on a query from database or the like)
Solved! Go to Solution.
I would do something like...
1) Query database/get the number you need
2) Do a while loop and call into the NBWS to fire off each instance of the process you need. (I would put whatever activity/process you need as a child process - to make things easy)
Obviously you can do a parallel block but will not be dynamic.
would need more information around your use case to give a better idea...
I have a child process to, lets say write into certain files in a target folder. What data is to be written into which file, depends on the result of a database query.
The main part is that this should be done in parallel. Say I run a select query and obtain 5 records, then I need to create 5 instances of the same child process, which must be run simultaneously.
Is there a way of doing this?
Based on that use-case, I think what I said above (using a while loop with calls to start the process from the NBWS) might be best.
Although there might be some lag on each call if you use WSDL method. You might have to work with it a bit to get it setup and working as you wish.
Even if each activity executes back to back, they are not truly/technically in paraellel, however they might all be executed in the same second. (gives the appearance of parallel)
If you need an ENH to the product please open a case with your cisco contract ID.
If you do the file-write operations in a child process, there is a way to configure a child process (from the parent) to run asynchronously.
You could put the child process in a for-each loop, iterate over the rows from your query, and basically launch the child process to write. The loop would repeat for the next row without waiting for the chile process write operations to complete.
The drawback to this is that, if you have something downstream in the workflow that needs to start running after *all* parallel operations are complete, you have to do some other stuff to indicate "start all operations" and "all operations complete". However, it's an easy way to have these child processes running in parallel, and having a dynamic number of them at a time.
Thanks for your suggestion.
I tried using the for-each loop, but it turns out the loop waits for the child process to complete before continuing with the iteration, so it's still sequential.