WorkflowQueue.UnregisterForQueueItemAvailable Método

Definición

Anula un suscriptor en el evento QueueItemAvailable.

public:
 void UnregisterForQueueItemAvailable(System::Workflow::ComponentModel::IActivityEventListener<System::Workflow::ComponentModel::QueueEventArgs ^> ^ eventListener);
public void UnregisterForQueueItemAvailable (System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.QueueEventArgs> eventListener);
member this.UnregisterForQueueItemAvailable : System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.QueueEventArgs> -> unit
Public Sub UnregisterForQueueItemAvailable (eventListener As IActivityEventListener(Of QueueEventArgs))

Parámetros

eventListener
IActivityEventListener<QueueEventArgs>

Un suscriptor para QueueEventArgs que implementa la interfaz IActivityEventListener<T>.

Excepciones

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

Ejemplos

En el siguiente código de ejemplo se muestra cómo crear un WorkflowQueue llamando al método WorkflowQueuingService.GetWorkflowQueue. También utiliza UnregisterForQueueItemAvailable para anular el agente de escucha especificado.

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 void DoUnsubscribe(ActivityExecutionContext context, IActivityEventListener<QueueEventArgs> listener)
{
    if (!this.subscriptionId.Equals(Guid.Empty))
    {
        FileWatcherService fileService = context.GetService<FileWatcherService>();
        fileService.UnregisterListener(this.subscriptionId);
        this.subscriptionId = Guid.Empty;
    }

    WorkflowQueuingService qService = context.GetService<WorkflowQueuingService>();
    WorkflowQueue queue = qService.GetWorkflowQueue(this.QueueName);

    queue.UnregisterForQueueItemAvailable(listener);
}
Private Sub DoUnsubscribe(ByVal context As ActivityExecutionContext, ByVal listener As IActivityEventListener(Of QueueEventArgs))
    If Not Me.subscriptionId.Equals(Guid.Empty) Then
        Dim fileService As FileWatcherService = context.GetService(Of FileWatcherService)()
        fileService.UnregisterListener(Me.subscriptionId)
        Me.subscriptionId = Guid.Empty
    End If

    Dim qService As WorkflowQueuingService = context.GetService(Of WorkflowQueuingService)()
    Dim queue As WorkflowQueue = qService.GetWorkflowQueue(Me.QueueName)
    queue.UnregisterForQueueItemAvailable(listener)
End Sub

Se aplica a

Consulte también