WF 4 中工作流 InstanceId 的关联
在 .NET 4.0 下的 Windows Workflow Foundation 中,是否有一种方法可以根据长期运行的持久工作流的 InstanceId (GUID) 关联操作?
例如:
- 操作 1 创建工作流实例,将工作流实例 ID 返回给客户端
- 客户端稍后可以查询 InstanceStore 数据库以从实例视图检索 InstanceId
- 客户端调用操作 2 并传递 InstanceId 以进行基于内容的关联
如果我有客户端,我可以执行所有这些操作创建 GUID 并将其传递给第一个操作,在基于内容的关联中使用该值,然后在持久化时提升该值。但这似乎是多余的,因为工作流程已经为实例创建了 GUID。
In Windows Workflow Foundation under .NET 4.0, is there a way to correlate operations based on the InstanceId (GUID) of a long-running persisted workflow?
For example:
- Operation 1 creates workflow instance, returns workflow instance ID to client
- Client may later query InstanceStore database to retrieve InstanceId from Instances view
- Client calls Operation 2 and passes InstanceId for content-based correlation
I can do all of this if I have the client create and pass a GUID to the first operation, use that value in content-based correlation, then promote that value when persisting. That seems redundant, though, since the workflow is already creating a GUID for the instance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个活动以从传入的上下文中检索工作流实例 ID,并从 SendReply 活动返回该 ID。接下来使用 SendReply 上的 CorrelationInitializer 来设置请求关联。
Create an activity to retrieve the workflow instance Id from the context passed in and return this from the SendReply activity. Next use the CorrelationInitializer on the SendReply to setup the request correlation.