列出当前在 .Net 4.0 中运行的工作流 [英] Listing Currently Running Workflows in .Net 4.0

查看:29
本文介绍了列出当前在 .Net 4.0 中运行的工作流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 .Net 4.0 工作流应用程序托管在 WCF 中,它接受一个请求来处理一些信息.此信息通过 Web 服务传递到辅助系统,并返回一个布尔值,指示它将处理该信息.

I've got a .Net 4.0 Workflow application hosted in WCF that takes a request to process some information. This information is passed to a secondary system via a web service and returns a bool indicating that its going to process that information.

然后我的工作流程循环,休眠 5 分钟,然后查询辅助系统以查看信息处理是否完成.

My workflow then loops, sleeping for 5 minutes and then querying the secondary system to see if processing of the information is complete.

当它完成时,工作流程结束.

When its complete the workflow finishes.

我在 SQL 中保留了这个,并且它运行良好.

I have this persisting in SQL, and it works perfectly.

我的问题是如何检索持久化工作流的列表,以便将它们与原始请求联系起来?我希望我的 UI 能够在网格中列出正在运行的工作流以及它们运行的​​经过时间.

My question is how do I retrieve a list of the persisted workflows in such a way that I can tie them back to the original request? I'd like my UI to be able to list the running workflows in a grid with the elapsed time that they've been run.

我曾考虑将工作流 GUID 存储在我的主数据库中并以这种方式生成列表,但我真正想要的是能够协调我认为正在运行的内容和持久存储认为正在运行的内容.

I've thought about storing the workflow GUID in my primary DB and generating the list that way, but what I'd really like is to be able to reconcile what I think is running, and what the persistant store thinks is running.

我还希望能够选择一个正在运行的工作流程,并在用户确定其出现问题时将其关闭或完全重新启动.

I'd also like to be able to select a running workflow and kill it off or completely restart it if the user determines that its gone screwy.

推荐答案

您可以使用 SqlWorkflowInstanceStore 提升 工作流中的数据.结果是它们使用 InstancePromotedPropertiesTable 与 InstancesTable 中的工作流数据一起存储.使用 InstancePromotedProperties 视图是查询数据的最简单方法.

You can promote data from the workflow using the SqlWorkflowInstanceStore. The result is they are stored alongside the workflow data in the InstancesTable using the InstancePromotedPropertiesTable. Using the InstancePromotedProperties view is the easiest way of querying you data.

这篇 博文将向您展示您需要的代码.

This blog post will show you the code you need.

这篇关于列出当前在 .Net 4.0 中运行的工作流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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