WorkflowQueuingService.GetWorkflowQueue(IComparable) Método

Definición

Recupera el WorkflowQueue especificado.

public:
 System::Workflow::Runtime::WorkflowQueue ^ GetWorkflowQueue(IComparable ^ queueName);
public System.Workflow.Runtime.WorkflowQueue GetWorkflowQueue (IComparable queueName);
member this.GetWorkflowQueue : IComparable -> System.Workflow.Runtime.WorkflowQueue
Public Function GetWorkflowQueue (queueName As IComparable) As WorkflowQueue

Parámetros

queueName
IComparable

Nombre del objeto WorkflowQueue que se va a recuperar.

Devoluciones

Un objeto WorkflowQueue.

Excepciones

queueName es una referencia nula (Nothing en Visual Basic).

no se encontró el WorkflowQueue especificado.

Ejemplos

El ejemplo de código siguiente muestra un método, denominado CreateQueue, que inicializa un objeto WorkflowQueuingService llamando al método ActivityExecutionContext.GetService. A continuación, el código utiliza el método Exists para determinar si existe un WorkflowQueue con un nombre específico. Si no existe, el código llama al método CreateWorkflowQueue; si sí que existe, el código llama al método GetWorkflowQueue.

Este ejemplo de código forma parte de la muestra de SDK de actividad de observador de archivo del archivo FileSystemEvent.cs. Para obtener más información, vea Actividad del monitor del sistema de archivos.

private WorkflowQueue CreateQueue(ActivityExecutionContext context)
{
    Console.WriteLine("CreateQueue");
    WorkflowQueuingService qService = context.GetService<WorkflowQueuingService>();

    if (!qService.Exists(this.QueueName))
    {
        qService.CreateWorkflowQueue(this.QueueName, true);
    }

    return qService.GetWorkflowQueue(this.QueueName);
}
Private Function CreateQueue(ByVal context As ActivityExecutionContext) As WorkflowQueue
    Console.WriteLine("CreateQueue")
    Dim qService As WorkflowQueuingService = context.GetService(Of WorkflowQueuingService)()

    If Not qService.Exists(Me.queueName) Then
        qService.CreateWorkflowQueue(Me.queueName, True)
    End If

    Return qService.GetWorkflowQueue(Me.QueueName)
End Function

Se aplica a

Consulte también