Share via


WorkflowQueue.RegisterForQueueItemAvailable Metodo

Definizione

Registra un sottoscrittore per l'evento QueueItemAvailable.

Overload

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>)

Registra un sottoscrittore per l'evento QueueItemAvailable.

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>, String)

Registra un sottoscrittore per l'evento QueueItemAvailable.

Commenti

È possibile utilizzare i metodi RegisterForQueueItemAvailable di overload per registrare un sottoscrittore per l'evento QueueItemAvailable. L'evento QueueItemAvailable viene utilizzato per notificare ai sottoscrittori che un elemento è stato recapitato (in modo asincrono) a questa WorkflowQueue.

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>)

Registra un sottoscrittore per l'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))

Parametri

eventListener
IActivityEventListener<QueueEventArgs>

Sottoscrittore per un elemento QueueEventArgs che implementa l'interfaccia IActivityEventListener<T>.

Eccezioni

eventListener è un riferimento null (Nothing in Visual Basic).

Esempio

Nell'esempio di codice seguente viene illustrato come creare una classe WorkflowQueue chiamando il metodo WorkflowQueuingService.GetWorkflowQueue. Utilizza anche il metodo RegisterForQueueItemAvailable per registrare il listener specificato.

Questo esempio di codice fa parte dell'esempio SDK File Watcher Activity nel file FileSystemEvent.cs. Per altre informazioni, vedere Attività Watcher di File System.

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

Vedi anche

Si applica a

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>, String)

Registra un sottoscrittore per l'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)

Parametri

eventListener
IActivityEventListener<QueueEventArgs>

Sottoscrittore per un elemento QueueEventArgs che implementa l'interfaccia IActivityEventListener<T>.

subscriberQualifiedName
String

QualifiedName dell'attività che sta sottoscrivendo l'evento QueueItemAvailable o un riferimento null (Nothing in Visual Basic).

Eccezioni

eventListener è un riferimento null (Nothing).

Commenti

Se il nome completo dell'attività di sottoscrizione è fornito da subscriberQualifiedName, viene restituito nella proprietà WorkflowQueueInfo.SubscribedActivityNames della classe WorkflowQueueInfo associata a questa coda quando il metodo WorkflowInstance.GetWorkflowQueueData viene chiamato.

Si applica a