问题描述
我需要一个需要监听多个事件的工作流,任何事件都会进一步推动工作流.
I need a workflow where need to listen for multiple events any event will drive workflow further.
一些操作 --> 调用外部方法 --> 这里有 3 个事件,任何一个都可以作为响应.
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?
推荐答案
无论您使用顺序工作流还是状态机工作流活动作为根工作流类型,您仍然可以处理事件.状态机在处理事件和交换状态方面要好得多,因为它几乎迫使您同时进行.在我看来,它比顺序工作流强大得多,并提供所有相同的功能以及一些功能.就我个人而言,我没有理由再次使用顺序工作流.
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.
然而,顺序工作流确实有一个很棒的优点.它们很简单.它没有比自上而下的工作流程更容易理解,如果您真的让最终用户可以使用设计器,那就太好了.在顺序工作流中,您可以使用 ListenActivity 以相同的方式侦听事件.删除 ListenActivity,右键单击并根据需要添加尽可能多的不同分支,每个要侦听的事件一个.最后,在每个事件中删除并配置 HandleEventActivity,将它们分配给您想要订阅的事件.
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.
这篇关于在工作流中需要监听多个事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!