SqlWorkflowInstanceStore.InstanceLockedExceptionAction Propriedade

Definição

Especifica a ação a ser tomada quando o provedor de persistência captura um InstanceLockedException.Specifies the action to be taken when the persistence provider catches an 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

Valor da propriedade

InstanceLockedExceptionAction

A ação a ser tomada quando o provedor de persistência capturar um InstanceLockedExceptionThe action to be taken when the persistence provider catches an InstanceLockedException

Exemplos

O exemplo de código a seguir demonstra como usar InstanceLockedExceptionAction em um SqlWorkflowInstanceStore .The following code sample demonstrates using InstanceLockedExceptionAction in a SqlWorkflowInstanceStore. Este exemplo é do exemplo de configuração interna .This example is from the Built-in Configuration sample.

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();
}

Comentários

Especifique a ação que um host de serviço deve executar quando uma instância do serviço de fluxo de trabalho passa por um InstanceLockedException .Specify what action a service host should take when a workflow service instance experiences an InstanceLockedException. O host de serviço recebe um InstanceLockedException quando tenta bloquear uma instância que já está bloqueada por outro proprietário.The service host receives an InstanceLockedException when it tries to lock an instance that is already locked by another owner. Os valores possíveis estão na lista a seguir:The possible values are in the following list:

  • None.None. O host de serviço não tenta bloquear a instância e passa o InstanceLockedException ao chamador.The service host does not attempt to lock the instance and passes the InstanceLockedException to the caller.

  • BasicRetry.BasicRetry. O host de serviço reattempts bloquear a instância com um intervalo de repetição linear e passa a exceção para o chamador no final da sequência.The service host reattempts to lock the instance with a linear retry interval and passes the exception to the caller at the end of the sequence.

  • AggressiveRetry.AggressiveRetry. Reattempts de host do serviço bloquear a instância com um atraso cresce exponencialmente e passa o InstanceLockedException ao chamador no final da sequência.The service host reattempts to lock the instance with an exponentially increasing delay and passes the InstanceLockedException to the caller at the end of the sequence. Os intervalos são curtos no início em uma tentativa de adquirir o bloqueio o mais rápido possível e os intervalos são maiores com todas as tentativas malsucedidas.The intervals are short in the beginning in an attempt to acquire the lock as quickly as possible and the intervals gets bigger with every unsuccessful attempt.

Aplica-se a