工作流程:如何向并行活动的一个分支发出信号以从另一分支结束?
我有一个具有并行活动的工作流程,其中一个分支工作,另一个分支有一个可以关闭工作流程的接收活动(是使用 HandleExternalEvent 执行此操作的正确方法吗?)。当然,问题在于,如果从未调用接收活动,则工作分支将完成并等待接收活动分支。如何向另一个分支发出信号以关闭活动?我尝试过使用监听活动来保存接收活动和自定义事件活动,但我也缺少一些关于如何使其工作的信息。
I have a workflow with a parallel activity, where one branch does work and the other has a receive activity that can shut the workflow down (is the proper way to do this with a HandleExternalEvent instead?). The problem, of course, is that if the receive activity is never called, the work branch completes and waits on the receive activity branch. How can I signal the other branch to close the activity? I've toyed a bit with using a listen activity to hold the receive activity and a custom event activity, but I'm missing something on how to make that work, as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用“CompletionCondition”,它是一个并行活动属性,指示如果分支结束,并行活动是否必须完成。
您可以检查它 此处
You can use 'CompletionCondition", which is a parallel activity property that indicates whether parallel activity must finish if a branch ends.
You can check it here
您可以使用 ActivityExecutionContext 对象上的 CancelActivity 方法取消备用分支上的侦听活动:
http://msdn.microsoft.com/en-us/library/system.workflow.componentmodel.activityexecutioncontext.cancelactivity.aspx
You could cancel the listening activity on the alternate branch using the CancelActivity method on the ActivityExecutionContext object:
http://msdn.microsoft.com/en-us/library/system.workflow.componentmodel.activityexecutioncontext.cancelactivity.aspx