使用自托管 WorkflowServiceHost 重新启动持久工作流程

发布于 2024-10-18 05:09:58 字数 964 浏览 5 评论 0原文

我正在尝试弄清楚如何恢复我使用 WorkflowServiceHost 自托管的持久工作流程。目前,我的主机将持久性和空闲行为连接起来,如下所示:

        // Persistence
        var connStr = @"";
        var behavior = new SqlWorkflowInstanceStoreBehavior(connStr);
        behavior.InstanceCompletionAction = InstanceCompletionAction.DeleteNothing;
        behavior.InstanceLockedExceptionAction = InstanceLockedExceptionAction.AggressiveRetry;
        behavior.InstanceEncodingOption = InstanceEncodingOption.None;
        host.Description.Behaviors.Add(behavior);

        // Idle behaviour
        var idleBehavior = new WorkflowIdleBehavior();
        idleBehavior.TimeToPersist = TimeSpan.FromMinutes(2);
        idleBehavior.TimeToUnload = TimeSpan.FromMinutes(2);
        host.Description.Behaviors.Add(behavior);

我将工作流实例 GUID 与工作流中包含的自定义活动内的数据库中的 ProductID 存储在一起,因此我能够轻松地将特定工作流实例跟踪到产品 ID。我希望能够以某种方式将此产品 ID 传递给我的 ServiceHost,并让它为我恢复正确的持久工作流程。

谁能指出我如何做到这一点的正确方向?

预先非常感谢 伊恩

I'm trying to work out how to resume a persisted workflow that I'm self-hosting with a WorkflowServiceHost. Currently my host wires up persistence and idling behaviour like so:

        // Persistence
        var connStr = @"";
        var behavior = new SqlWorkflowInstanceStoreBehavior(connStr);
        behavior.InstanceCompletionAction = InstanceCompletionAction.DeleteNothing;
        behavior.InstanceLockedExceptionAction = InstanceLockedExceptionAction.AggressiveRetry;
        behavior.InstanceEncodingOption = InstanceEncodingOption.None;
        host.Description.Behaviors.Add(behavior);

        // Idle behaviour
        var idleBehavior = new WorkflowIdleBehavior();
        idleBehavior.TimeToPersist = TimeSpan.FromMinutes(2);
        idleBehavior.TimeToUnload = TimeSpan.FromMinutes(2);
        host.Description.Behaviors.Add(behavior);

I am storing the workflow instance GUID against a ProductID in my database inside a custom activity contained in the workflow, so I am able to easily trace a specific workflow instance to a product ID. I want to be able to somehow pass this Product ID to my ServiceHost and have it resume the correct persisted workflow for me.

Can anyone point me in the right direction on how to do this?

Many thanks in advance
Ian

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

似最初 2024-10-25 05:09:58

您将需要阅读内容关联。您将把您的 ProductID 与您的接收活动相关联。当您到达接收时,将创建一个书签,并且您的工作流程将被保留。您调用接收并传入您的 ProductID,并且由于相关性,WF 运行时知道要恢复哪个实例。

You're going to want to read about Content Correlation. You'll correlate your ProductID with your Receive activities. A bookmark will be created when you reach a receive, and your workflow will be persisted. You call the receive and pass your ProductID in and because of the correlation, the WF runtime knows which instance to resume.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文