Parallel Process

Apr 29, 2009 at 1:13 PM
I have a system that use a single column for case status. SimpleStateMachine state drives the value of this case status. So right now I have a design dillema.

I have a situation where I need to start two things at the same time. Say that the current state is DocumentsPending. Now I have to send two types of different documetns, which normal will move the state to DistrictLetterDocumentPrinted and ApprovalLetterDocumentPrinted. The next step of each of these statuses are DistrictDocumentWaitForResult and ApprovalLetterlDocumentWaitForResult.

Essentially I am sending two categories of documents to separate institution and I am waitng for both of their results to arrive before I move forward and I want the ability to check where the status of the case are at any given time.

Now should I add an additional case status column so that i can store both DistrictLetterDocumentPrinted and ApprovalLetterDocumentPrinted or should I create a third combination status which says "DOAndApprLetterPrinted" which adds 2/3 additional statuses for each combination but enable me to use just a single column.

Apr 30, 2009 at 6:30 PM
That's a tough one. If you were using a sequential workflow, this would be a no brainer, you'd do a branch and join. We also have this need in our process flows, and I haven't settled on the right answer yet. Our workaround has been to handle it at a higher level, but I'm not terribly happy with our workaround, so I won't bother explaining it. Of your two options, I don't think I'd start creating states that represent combinations of other states, that sounds like a slipper slope. Instead you may want to have a single state, AwaitingDocumentResults, and this state can either host an inner state machine for each document, or can handle waiting for the responses in application logic. In the end, I think the state machine library should probably be given the ability to manage multiple child states automatically, but it will take care not to drift into re-creating WF and building a sequential workflow library into the state machine library, where it doesn't belong. Probably not a hugely helpful answer, but it's all I've got :)