WorkflowQueue.RegisterForQueueItemAvailable Método

Definición

Registra un suscriptor en el evento QueueItemAvailable.

Sobrecargas

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>)

Registra un suscriptor en el evento QueueItemAvailable.

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>, String)

Registra un suscriptor en el evento QueueItemAvailable.

Comentarios

Puede utilizar los métodos RegisterForQueueItemAvailable sobrecargados para registrar un suscriptor para el evento QueueItemAvailable. El evento QueueItemAvailable se utiliza para notificar a los suscriptores que se ha entregado (de una manera asincrónica) un elemento a WorkflowQueue.

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>)

Registra un suscriptor en el evento QueueItemAvailable.

public:
 void RegisterForQueueItemAvailable(System::Workflow::ComponentModel::IActivityEventListener<System::Workflow::ComponentModel::QueueEventArgs ^> ^ eventListener);
public void RegisterForQueueItemAvailable (System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.QueueEventArgs> eventListener);
member this.RegisterForQueueItemAvailable : System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.QueueEventArgs> -> unit
Public Sub RegisterForQueueItemAvailable (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 RegisterForQueueItemAvailable para registrar 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 Boolean DoSubscribe(ActivityExecutionContext context, IActivityEventListener<QueueEventArgs> listener)
{
    WorkflowQueue queue = CreateQueue(context);
    queue.RegisterForQueueItemAvailable(listener);

    FileWatcherService fileService = context.GetService<FileWatcherService>();
    this.subscriptionId = fileService.RegisterListener(this.QueueName, this.Path, this.Filter, this.NotifyFilter, this.IncludeSubdirectories);
    return (subscriptionId != Guid.Empty);
}
Private Function DoSubscribe(ByVal context As ActivityExecutionContext, ByVal listener As IActivityEventListener(Of QueueEventArgs)) As Boolean
    Dim Queue As WorkflowQueue = CreateQueue(context)
    Queue.RegisterForQueueItemAvailable(listener)

    Dim fileService As FileWatcherService = context.GetService(Of FileWatcherService)()
    Me.subscriptionId = fileService.RegisterListener(Me.queueName, Me.Path, Me.Filter, Me.NotifyFilter, Me.IncludeSubdirectories)
    Return Not subscriptionId = Guid.Empty
End Function

Consulte también

Se aplica a

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>, String)

Registra un suscriptor en el evento QueueItemAvailable.

public:
 void RegisterForQueueItemAvailable(System::Workflow::ComponentModel::IActivityEventListener<System::Workflow::ComponentModel::QueueEventArgs ^> ^ eventListener, System::String ^ subscriberQualifiedName);
public void RegisterForQueueItemAvailable (System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.QueueEventArgs> eventListener, string subscriberQualifiedName);
member this.RegisterForQueueItemAvailable : System.Workflow.ComponentModel.IActivityEventListener<System.Workflow.ComponentModel.QueueEventArgs> * string -> unit
Public Sub RegisterForQueueItemAvailable (eventListener As IActivityEventListener(Of QueueEventArgs), subscriberQualifiedName As String)

Parámetros

eventListener
IActivityEventListener<QueueEventArgs>

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

subscriberQualifiedName
String

QualifiedName de la actividad que está suscribiendo al evento QueueItemAvailable o una referencia nula (Nothing en Visual Basic).

Excepciones

eventListener es una referencia nula (Nothing).

Comentarios

Si subscriberQualifiedName proporciona el nombre completo de la actividad de suscripción, se devuelve en WorkflowQueueInfo.SubscribedActivityNames de WorkflowQueueInfo asociado a esta cola cuando se llama a WorkflowInstance.GetWorkflowQueueData.

Se aplica a