WorkflowQueue Classe

Definição

Cuidado

The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*

Representa uma fila de fluxo de trabalho.

public ref class WorkflowQueue
public class WorkflowQueue
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public class WorkflowQueue
type WorkflowQueue = class
[<System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>]
type WorkflowQueue = class
Public Class WorkflowQueue
Herança
WorkflowQueue
Atributos

Exemplos

O exemplo de código a seguir demonstra como você pode criar um WorkflowQueue chamando o WorkflowQueuingService.GetWorkflowQueue método . Ele também usa a Count propriedade para determinar se existem mensagens na fila atual. Por fim, o código usa o Dequeue método para remover e retornar o primeiro objeto na fila.

Este exemplo de código faz parte do Exemplo de SDK de Atividade do Observador de Arquivos do arquivo FileSystemEvent.cs. Para obter mais informações, consulte Atividade do Observador do Sistema de Arquivos.

private bool ProcessQueueItem(ActivityExecutionContext context)
{
    WorkflowQueuingService qService = context.GetService<WorkflowQueuingService>();
    if (!qService.Exists(this.QueueName))
    {
        return false;
    }

    WorkflowQueue queue = qService.GetWorkflowQueue(this.QueueName);

    // If the queue has messages, then process the first one
    if (queue.Count == 0)
    {
        return false;
    }

    FileWatcherEventArgs e = (FileWatcherEventArgs)queue.Dequeue();

    // Raise the FileSystemEvent
    base.RaiseGenericEvent<FileWatcherEventArgs>(FileSystemEvent.FileWatcherEventHandlerEvent, this, e);

    DoUnsubscribe(context, this);
    DeleteQueue(context);
    return true;
}
Private Function ProcessQueueItem(ByVal context As ActivityExecutionContext) As Boolean

    Dim qService As WorkflowQueuingService = context.GetService(Of WorkflowQueuingService)()

    If Not qService.Exists(Me.QueueName) Then
        Return False
    End If

    Dim Queue As WorkflowQueue = qService.GetWorkflowQueue(Me.QueueName)

    ' If the queue has messages, then process the first one
    If Queue.Count = 0 Then
        Return False
    End If

    Dim e As FileWatcherEventArgs = CType(Queue.Dequeue(), FileWatcherEventArgs)

    ' Raise the FileSystemEvent
    MyBase.RaiseGenericEvent(Of FileWatcherEventArgs)(FileSystemEvent.FileWatcherEventHandlerEvent, Me, e)
    DoUnsubscribe(context, Me)
    DeleteQueue(context)
    Return True
End Function

Comentários

Observação

Este material discute tipos e namespaces obsoletos. Para obter mais informações, consulte Deprecated Types in Windows Workflow Foundation 4.5 (Tipos preteridos no Windows Workflow Foundation 4.5).

As filas de fluxo de trabalho são usadas para passar mensagens entre um host ou serviços de host e atividades em um fluxo de trabalho. Qualquer atividade pode criar um WorkflowQueue chamando WorkflowQueuingService.CreateWorkflowQueuee um host, um serviço ou outra atividade pode chamar Enqueue para adicionar um item a esse WorkflowQueue. Você pode assinar o QueueItemAvailable evento para ser notificado quando um item chegar no WorkflowQueue. Você pode usar Peek para examinar um item no início do WorkflowQueue e Dequeue para remover um item do WorkflowQueue. Cada WorkflowQueue um está associado a um WorkflowQueuingService que você pode usar para executar outras operações de gerenciamento no WorkflowQueue, como a exclusão da fila. QueuingService expõe o associado a WorkflowQueuingService este WorkflowQueue.

Propriedades

Count
Obsoleto.

Obtém o número de itens contidos no WorkflowQueue.

Enabled
Obsoleto.

Obtém ou define um valor que especifica se a WorkflowQueue está habilitada.

QueueName
Obsoleto.

Obtém o nome da fila de fluxo de trabalho.

QueuingService
Obsoleto.

Obtém o serviço de enfileiramento associado a esta WorkflowQueue.

Métodos

Dequeue()
Obsoleto.

Remove e retorna o objeto no início do WorkflowQueue.

Enqueue(Object)
Obsoleto.

Adiciona um objeto ao final do WorkflowQueue.

Equals(Object)
Obsoleto.

Determina se o objeto especificado é igual ao objeto atual.

(Herdado de Object)
GetHashCode()
Obsoleto.

Serve como a função de hash padrão.

(Herdado de Object)
GetType()
Obsoleto.

Obtém o Type da instância atual.

(Herdado de Object)
MemberwiseClone()
Obsoleto.

Cria uma cópia superficial do Object atual.

(Herdado de Object)
Peek()
Obsoleto.

Retorna o objeto ao início da WorkflowQueue sem removê-lo.

RegisterForQueueItemArrived(IActivityEventListener<QueueEventArgs>)
Obsoleto.

Registra um assinante para o evento QueueItemArrived.

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>)
Obsoleto.

Registra um assinante para o evento QueueItemAvailable.

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>, String)
Obsoleto.

Registra um assinante para o evento QueueItemAvailable.

ToString()
Obsoleto.

Retorna uma cadeia de caracteres que representa o objeto atual.

(Herdado de Object)
UnregisterForQueueItemArrived(IActivityEventListener<QueueEventArgs>)
Obsoleto.

Cancela o registro de um assinante para o evento QueueItemArrived.

UnregisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>)
Obsoleto.

Cancela o registro de um assinante para o evento QueueItemAvailable.

Eventos

QueueItemArrived
Obsoleto.

Ocorre quando um item é entregue nesta WorkflowQueue.

QueueItemAvailable
Obsoleto.

Ocorre quando um item está disponível nesta WorkflowQueue.

Aplica-se a

Confira também