WorkflowQueue.UnregisterForQueueItemAvailable Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Unregisters a subscriber to the QueueItemAvailable event.
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))
Parameters
- eventListener
- IActivityEventListener<QueueEventArgs>
A subscriber for QueueEventArgs that implements the IActivityEventListener<T> interface.
Exceptions
eventListener
is a null reference (Nothing
in Visual Basic).
Examples
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);
}
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