我如何知道工作流程何时完成? [英] How do I know when the workflow is complete?

查看:98
本文介绍了我如何知道工作流程何时完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类使用TPL Dataflow实现了由3个步骤组成的工作流。在构造函数中,我将步骤创建为TransformBlocks并使用LinkTo将其链接起来,并将DataflowLinkOptions.PropagateCompletion设置为true。该类公开了一个
方法,该方法通过在第一步调用SendAsync来启动工作流。该方法返回"完成"按钮。工作流程最后一步的属性。目前,工作流程中的步骤似乎按预期执行,但最终步骤永远不会完成
,除非我明确地在其上调用Complete。但这样做会使工作流程短路并且没有执行任何步骤?我做错了什么?

I've got a class the implements a workflow composed of 3 steps using TPL Dataflow. In the constructor I create the steps as TransformBlocks and link them up using LinkTo with DataflowLinkOptions.PropagateCompletion set to true. The class exposes a single method which kicks of the workflow by calling SendAsync on the 1st step. The method returns the "Completion" property of the final step of the workflow. At the moment the steps in the workflow appear to execute as expected but final step never completes unless I explicitly call Complete on it. But doing that short-circuits the workflow and none of the steps are executed? What am I doing wrong?

推荐答案

如果你已经正确设置了所有内容,那么在将所有数据发布到第一个块后,你应该在第一个块上调用Complete()
。这样,当第一个块变空时,它就完成了管道中的第二个块,依此类推。
If you've set up everything correctly, then after you post all the data to the first block, you should call Complete() on the first block. That way, when the first block becomes empty, it completes the second block in the pipeline and so forth.


这篇关于我如何知道工作流程何时完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆