开发者

Must I configure persistence and unload settings explicitly when using SqlInstanceStore?

I have a self-hosted WF 4 service that's making use of the SqlWorkflowInstanceStore. I'm configuring it like so:

        var behavior = new SqlWorkflowInstanceStoreBehavior(connStr);
        TimeSpan detectionPeriod = behavior.RunnableInstancesDetectionPeriod;
        behavior.InstanceCompletionAction = InstanceCompletionAction.DeleteNothing;
        behavior.InstanceLockedExceptionAction = 开发者_如何学CInstanceLockedExceptionAction.AggressiveRetry;
        behavior.InstanceEncodingOption = InstanceEncodingOption.None;
        host.Description.Behaviors.Add(behavior);

Futher on down in my code, I'm explitly adding the IdleBehavior behaviour to the host in order to ensure unloading is being applied. Basically, I'm unsure what the SqlInstanceStore does in terms of, specifically, unloading of workflows. Does it manage this itself, or do I still need to add my IdleBehavior, like so:

        // Idle behaviour
        var idleBehavior = new WorkflowIdleBehavior();

        host.Description.Behaviors.Add(idleBehavior);

Thanks in advance.


The WorkflowIdleBehavior will let the WorkflowServiceHost automatically persist/unload workflows when they are not active. You don't need to do this but it helps with the scalabilty. Even without the idle behavior the workflow state will be saved during the execution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜