Sdílet prostřednictvím


WorkflowQueue.RegisterForQueueItemAvailable Metoda

Definice

Zaregistruje odběratele QueueItemAvailable události.

Přetížení

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>)

Zaregistruje odběratele QueueItemAvailable události.

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>, String)

Zaregistruje odběratele QueueItemAvailable události.

Poznámky

Přetížené RegisterForQueueItemAvailable metody můžete použít k registraci odběratele QueueItemAvailable události. Událost QueueItemAvailable se používá k upozornění odběratelů, že položka byla doručena (asynchronním způsobem) tomuto WorkflowQueueobjektu .

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>)

Zaregistruje odběratele QueueItemAvailable události.

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))

Parametry

eventListener
IActivityEventListener<QueueEventArgs>

Odběratel pro QueueEventArgs , který implementuje IActivityEventListener<T> rozhraní.

Výjimky

eventListener je odkaz s hodnotou null (Nothing v jazyce Visual Basic).

Příklady

Následující příklad kódu ukazuje, jak můžete vytvořit WorkflowQueue voláním WorkflowQueuingService.GetWorkflowQueue metody. Používá také RegisterForQueueItemAvailable k registraci zadaného naslouchacího procesu.

Tento příklad kódu je součástí ukázky sady SDK aktivity služby File Watcher ze souboru FileSystemEvent.cs. Další informace najdete v tématu Aktivita sledovacího procesu systému souborů.

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

Viz také

Platí pro

RegisterForQueueItemAvailable(IActivityEventListener<QueueEventArgs>, String)

Zaregistruje odběratele QueueItemAvailable události.

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)

Parametry

eventListener
IActivityEventListener<QueueEventArgs>

Odběratel pro QueueEventArgs , který implementuje IActivityEventListener<T> rozhraní.

subscriberQualifiedName
String

Aktivita QualifiedName , která se přihlašuje k odběru QueueItemAvailable události, nebo odkaz s hodnotou null (Nothing v jazyce Visual Basic).

Výjimky

eventListener je odkaz s hodnotou null (Nothing).

Poznámky

Pokud je kvalifikovaný název aktivity odběru zadán uživatelem subscriberQualifiedName, vrátí se při zavolání v WorkflowQueueInfo.SubscribedActivityNames přidružené WorkflowQueueInfo k této frontě WorkflowInstance.GetWorkflowQueueData .

Platí pro