问题
I need a workflow where need to listen for multiple events any event will drive workflow further.
some actions --> Call external method --> Here there 3 events any one would be the response.
What kind of activity i can use there where i can have three event handler. Any event will drive it further.
Thought of using state machine workflow but if there is anything i can use instead?
回答1:
Whether you use a sequential workflow or state machine workflow activity as your root workflow type, you can still handle events. The state machine is much better for handling events and swapping states as it pretty much forces you to do both. In my opinion, it is much more powerful than sequential workflows and provide all of the same functionality plus some. Personally, I have no reason to ever use a sequential workflow again.
However, sequential workflows do have one great pro to them. They are SIMPLE. It doesn't get much easier to understand than a top-to-bottom workflow, and is great if you are actually making the designer available to your end users. In a sequential workflow, you can listen for events the same way using the ListenActivity. Drop the ListenActivity out, right click and add as many different forks as you will need, one per event you want to listen for. Finally, drop and configure the HandleEventActivity in each one, assigning them to the events you are wanting to subscribe.
Listening for Events in a Sequential Workflow
Listening for Events in a State Machine Workflow
来源:https://stackoverflow.com/questions/454690/in-workflow-need-to-listen-for-multiple-events