SqlWorkflowInstanceStore.InstanceLockedExceptionAction Eigenschaft

Definition

Gibt die Auszuführende Aktion an, wenn der Persistenzanbieter eine 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

Eigenschaftswert

Die Aktion, die ausgeführt werden soll, wenn der Persistenzanbieter einen InstanceLockedException

Beispiele

Das folgende Codebeispiel veranschaulicht die Verwendung von InstanceLockedExceptionAction in einem 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();
}

Hinweise

Geben Sie an, welche Aktion ein Diensthost ausführen soll, wenn eine Workflowdienstinstanz eine InstanceLockedException. Der Diensthost empfängt eine InstanceLockedException Instanz, die bereits von einem anderen Besitzer gesperrt wurde. Die möglichen Werte sind in der folgenden Liste aufgeführt:

  • Keine. Der Diensthost versucht nicht, die Instanz zu sperren und den InstanceLockedException Aufrufer zu übergeben.

  • BasicRetry. Der Diensthost wiederholt die Instanz mit einem linearen Wiederholungsintervall und übergibt die Ausnahme an den Aufrufer am Ende der Sequenz.

  • Aggressives Retry. Der Diensthost versucht erneut, die Instanz mit einer exponentiell steigenden Verzögerung zu sperren und den InstanceLockedException Aufrufer am Ende der Sequenz an den Aufrufer zu übergeben. Die Intervalle sind kurz am Anfang in einem Versuch, die Sperre so schnell wie möglich abzurufen, und die Intervalle werden bei jedem erfolglosen Versuch größer.

Gilt für: