SqlWorkflowInstanceStore.RunnableInstancesDetectionPeriod Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Especifica o período de tempo após o qual o SQL Workflow Instance Store executa uma tarefa de deteção para detetar quaisquer instâncias de workflow executáveis ou ativables na base de dados de persistência após o ciclo de deteção anterior.
public:
property TimeSpan RunnableInstancesDetectionPeriod { TimeSpan get(); void set(TimeSpan value); };
public TimeSpan RunnableInstancesDetectionPeriod { get; set; }
member this.RunnableInstancesDetectionPeriod : TimeSpan with get, set
Public Property RunnableInstancesDetectionPeriod As TimeSpan
Valor de Propriedade
Retorna TimeSpan.
Exemplos
O exemplo de código seguinte demonstra o uso do RunnableInstancesDetectionPeriod num SqlWorkflowInstanceStoreperíodo .
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();
}
Observações
Executa SqlWorkflowInstanceStore uma tarefa interna que periodicamente desperta e verifica se existem instâncias executáveis na base de dados de persistência. Uma instância é executável se não estiver no estado suspenso ou no estado completo e satisfizer as seguintes condições:
A instância está desbloqueada e tem um temporizador pendente que expirou.
A instância é desbloqueada e seu status é Executando.
A instância tem um bloqueio expirado.
O SQL Workflow Instance Store levanta o HasRunnableWorkflowEvent quando encontra uma instância executável na base de dados e também encontra um host de workflow capaz de carregar a instância a correr no computador.
Quando um host de workflow recebe este evento, executa o TryLoadRunnableWorkflowCommand counter the instance store para carregar a instância na memória.
O tipo da propriedade é TimeSpan e o valor é da forma "hh:mm:ss". O valor mínimo é "00:00:01" (1 segundo). Se for omitido, por defeito é "00:00:05" (5 segundos). Este parâmetro é opcional.