SqlWorkflowInstanceStore.InstanceLockedExceptionAction 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지속성 공급자가 을 catch할 때 수행할 작업을 지정합니다 InstanceLockedException.
public:
property System::Activities::DurableInstancing::InstanceLockedExceptionAction InstanceLockedExceptionAction { System::Activities::DurableInstancing::InstanceLockedExceptionAction get(); void set(System::Activities::DurableInstancing::InstanceLockedExceptionAction value); };
public System.Activities.DurableInstancing.InstanceLockedExceptionAction InstanceLockedExceptionAction { get; set; }
member this.InstanceLockedExceptionAction : System.Activities.DurableInstancing.InstanceLockedExceptionAction with get, set
Public Property InstanceLockedExceptionAction As InstanceLockedExceptionAction
속성 값
지속성 공급자가 다음을 catch할 때 수행할 작업입니다. InstanceLockedException
예제
다음 코드 샘플에서는 .에서 InstanceLockedExceptionAction을 사용하는 방법을 SqlWorkflowInstanceStore보여 줍니다.
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();
}
설명
워크플로 서비스 인스턴스가 발생할 때 서비스 호스트가 수행해야 하는 작업을 지정합니다 InstanceLockedException. 서비스 호스트는 InstanceLockedException 다른 소유자가 이미 잠긴 인스턴스를 잠그려고 할 때 수신합니다. 가능한 값은 다음 목록에 있습니다.
없음. 서비스 호스트는 인스턴스를 잠그려고 시도하지 않고 호출자에게 전달합니다 InstanceLockedException .
BasicRetry. 서비스 호스트는 선형 재시도 간격으로 인스턴스를 잠그기 위해 다시 시도하며 시퀀스의 끝에 있는 호출자에게 예외를 전달합니다.
AggressiveRetry. 서비스 호스트는 기하급수적으로 증가하는 지연으로 인스턴스를 잠그기 위해 다시 시도하며 시퀀스의 끝에 호출자에게 전달합니다 InstanceLockedException . 간격은 가능한 한 빨리 잠금을 획득하기 위해 처음에는 짧으며 실패한 모든 시도에서 간격이 커집니다.