SqlWorkflowInstanceStore.HostLockRenewalPeriod 속성

정의

호스트가 워크플로 서비스 인스턴스의 잠금을 갱신하는 기간을 지정합니다.

public:
 property TimeSpan HostLockRenewalPeriod { TimeSpan get(); void set(TimeSpan value); };
public TimeSpan HostLockRenewalPeriod { get; set; }
member this.HostLockRenewalPeriod : TimeSpan with get, set
Public Property HostLockRenewalPeriod As TimeSpan

속성 값

기간입니다.

예제

다음 코드 샘플에서는 SqlWorkflowInstanceStore에 HostLockRenewalPeriod를 사용하는 방법을 보여 줍니다.

static void Main(string[] args)
{
    // Create service host.
    WorkflowServiceHost host = new WorkflowServiceHost(new CountingWorkflow(), new Uri(hostBaseAddress));

    // Add service endpoint.
    host.AddServiceEndpoint("ICountingWorkflow", new BasicHttpBinding(), "");

    // Define SqlWorkflowInstanceStoreBehavior:
    //   Set interval to renew instance lock to 5 seconds.
    //   Set interval to check for runnable instances to 2 seconds.
    //   Instance Store does not keep instances after it is completed.
    //   Select exponential back-off algorithm when retrying to load a locked instance.
    //   Instance state information is compressed using the GZip compressing algorithm.
    SqlWorkflowInstanceStoreBehavior instanceStoreBehavior = new SqlWorkflowInstanceStoreBehavior(connectionString);
    instanceStoreBehavior.HostLockRenewalPeriod = new TimeSpan(0, 0, 5);
    instanceStoreBehavior.RunnableInstancesDetectionPeriod = new TimeSpan(0, 0, 2);
    instanceStoreBehavior.InstanceCompletionAction = InstanceCompletionAction.DeleteAll;
    instanceStoreBehavior.InstanceLockedExceptionAction = InstanceLockedExceptionAction.AggressiveRetry;
    instanceStoreBehavior.InstanceEncodingOption = InstanceEncodingOption.GZip;
    host.Description.Behaviors.Add(instanceStoreBehavior);

    // Open service host.
    host.Open();

    // Create a client that sends a message to create an instance of the workflow.
    ICountingWorkflow client = ChannelFactory<ICountingWorkflow>.CreateChannel(new BasicHttpBinding(), new EndpointAddress(hostBaseAddress));
    client.start();

    Console.WriteLine("(Press [Enter] at any time to terminate host)");
    Console.ReadLine();
    host.Close();
}

설명

호스트가 이 기간 내에 잠금을 갱신(즉, 대여를 연장)하지 않으면 지속성 공급자가 인스턴스 잠금을 해제하며 다른 호스트가 인스턴스를 잠글 수 있습니다. 값이는 TimeSpan "hh: mm:" 형식입니다. 허용 되는 최소값은 "00: 00:01" (1 초)입니다. 이 속성의 기본값은 "00: 00:30" (30 초)입니다.

적용 대상