WorkflowQueue Class

 
Note: This API is now obsolete.

Represents a workflow queue.

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

System.Object
  System.Workflow.Runtime.WorkflowQueue

<ObsoleteAttribute("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")>
Public Class WorkflowQueue

NameDescription
System_CAPS_pubpropertyCount

Gets the number of items contained in the WorkflowQueue.

System_CAPS_pubpropertyEnabled

Gets or sets a value that specifies whether the WorkflowQueue is enabled.

System_CAPS_pubpropertyQueueName

Gets the name of the workflow queue.

System_CAPS_pubpropertyQueuingService

Gets the queuing service associated with this WorkflowQueue.

NameDescription
System_CAPS_pubmethodDequeue()

Removes and returns the object at the beginning of the WorkflowQueue.

System_CAPS_pubmethodEnqueue(Object)

Adds an object to the end of the WorkflowQueue.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodPeek()

Returns the object at the beginning of the WorkflowQueue without removing it.

System_CAPS_pubmethodRegisterForQueueItemArrived(IActivityEventListener(Of QueueEventArgs))

Registers a subscriber to the QueueItemArrived event.

System_CAPS_pubmethodRegisterForQueueItemAvailable(IActivityEventListener(Of QueueEventArgs))

Registers a subscriber to the QueueItemAvailable event.

System_CAPS_pubmethodRegisterForQueueItemAvailable(IActivityEventListener(Of QueueEventArgs), String)

Registers a subscriber to the QueueItemAvailable event.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodUnregisterForQueueItemArrived(IActivityEventListener(Of QueueEventArgs))

Unregisters a subscriber to the QueueItemArrived event.

System_CAPS_pubmethodUnregisterForQueueItemAvailable(IActivityEventListener(Of QueueEventArgs))

Unregisters a subscriber to the QueueItemAvailable event.

NameDescription
System_CAPS_pubeventQueueItemArrived

Occurs when an item is delivered on this WorkflowQueue.

System_CAPS_pubeventQueueItemAvailable

Occurs when an item is available on this WorkflowQueue.

System_CAPS_noteNote

This material discusses types and namespaces that are obsolete. For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

Workflow queues are used to pass messages between a host or host services and activities in a workflow. Any activity can create a WorkflowQueue by calling WorkflowQueuingService.CreateWorkflowQueue, and a host, a service, or another activity can call Enqueue to add an item to that WorkflowQueue. You can subscribe to the QueueItemAvailable event to be notified when an item arrives on the WorkflowQueue. You can use Peek to examine an item at the beginning of the WorkflowQueue and Dequeue to remove an item from the WorkflowQueue. Each WorkflowQueue is associated with a WorkflowQueuingService that you can use to perform other management operations on the WorkflowQueue, such as deleting the queue. QueuingService exposes the WorkflowQueuingService associated with this WorkflowQueue.

The following code example demonstrates how you can create a WorkflowQueue by calling the WorkflowQueuingService.GetWorkflowQueue method. It also uses the Count property to determine whether any messages exist in the current queue. Finally, the code uses the Dequeue method to remove and return the first object in the queue.

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 Function ProcessQueueItem(ByVal context As ActivityExecutionContext) As Boolean

    Dim qService As WorkflowQueuingService = context.GetService(Of WorkflowQueuingService)()

    If Not qService.Exists(Me.QueueName) Then
        Return False
    End If

    Dim Queue As WorkflowQueue = qService.GetWorkflowQueue(Me.QueueName)

    ' If the queue has messages, then process the first one
    If Queue.Count = 0 Then
        Return False
    End If

    Dim e As FileWatcherEventArgs = CType(Queue.Dequeue(), FileWatcherEventArgs)

    ' Raise the FileSystemEvent
    MyBase.RaiseGenericEvent(Of FileWatcherEventArgs)(FileSystemEvent.FileWatcherEventHandlerEvent, Me, e)
    DoUnsubscribe(context, Me)
    DeleteQueue(context)
    Return True
End Function

.NET Framework
Available since 3.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

System.Workflow.Runtime Namespace
Workflow and Application Communication
File System Watcher Activity

Return to top
Show: