WorkflowQueue.UnregisterForQueueItemAvailable Method (IActivityEventListener<QueueEventArgs>)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Unregisters a subscriber to the QueueItemAvailable event.

Namespace:   System.Workflow.Runtime
Assembly:  System.Workflow.Runtime (in System.Workflow.Runtime.dll)

public void UnregisterForQueueItemAvailable(
	IActivityEventListener<QueueEventArgs> eventListener
)

Parameters

eventListener
Type: System.Workflow.ComponentModel.IActivityEventListener<QueueEventArgs>

A subscriber for QueueEventArgs that implements the IActivityEventListener<T> interface.

Exception Condition
ArgumentNullException

eventListener is a null reference (Nothing in Visual Basic).

The following code example demonstrates how you can create a WorkflowQueue by calling the WorkflowQueuingService.GetWorkflowQueue method. It also uses the UnregisterForQueueItemAvailable to unregister the specified listener.

This code example is part of the File Watcher Activity SDK Sample from the FileSystemEvent.cs file. For more information, see File System Watcher Activity.

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

.NET Framework
Available since 3.0
Return to top
Show: