Step 1: Create Main Process
Step 2: Create Sub Process
Step 3: Create DB Adapter for getting instance count
You can read my blog post about how to create and use DBAdapter. Click for read.
Step 4: Check your "composite.xml" file.
Step 5: Calling your Sub Process with "Service Task"
Step 6: Call DB Adapter with "Service Task"
Step 7: Check Process Instance Count with "Exclusive Gateway"
If count equals 1, all off subprocesses are completed with/without error. Otherwise there must be a subprocess that is running, because all of subprocesses are generated with same ECID that is as same as main process ECID