Click or drag to resize

WorkflowQueueT Class

Implements a workflow-safe first-in-first-out (FIFO) queue that can be used by workflow signal methods to communicate with the running workflow logic.
Inheritance Hierarchy
SystemObject
  Neon.TemporalWorkflowQueueT

Namespace:  Neon.Temporal
Assembly:  Neon.Temporal (in Neon.Temporal.dll) Version: 2.2.0-alpha
Syntax
public class WorkflowQueue<T> : IDisposable

Type Parameters

T
Specifies the type of the queued items.

The WorkflowQueueT type exposes the following members.

Properties
  NameDescription
Public propertyCapacity
Returns the maximum number of items allowed in the queue at any given moment. This may not be set to a value less than 2.
Top
Methods
  NameDescription
Public methodCloseAsync

Closes the queue.

Note Note
This does nothing if the queue is already closed.
Public methodDequeueAsync
Attempts to dequeue an item from the queue with an optional timeout.
Public methodDispose
Closes the queue if it's not already closed.
Protected methodDispose(Boolean)
Releases all associated resources.
Public methodEnqueueAsync
Adds an item to the queue.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTryEnqueueAsync
Attempts to add an item to the queue. Unlike EnqueueAsync(T), this method does not block when the queue is full and returns false instead.
Top
Fields
  NameDescription
Public fieldStatic memberDefaultCapacity
The default maximum number of items allowed in a queue.
Top
Remarks

You can construct workflow queue instances in your workflows via NewQueueAsyncT(Int32), optionally specifying the maximum capacity of the queue. This defaults to DefaultCapacity and may not be less that 2 queued items.

Items are added to the queue via EnqueueAsync(T). This method will return immediately when the number of items currently in the queue is less than the capacity, otherwise the operation will block until an item has been dequeued and the queue is no longer full.

Note Note
Serialized item sizes must be less than 64 KiB.

Use DequeueAsync(TimeSpan) to read from the queue using an optional timeout.

Note Note

The WorkflowQueueT class is intended only for two scenarios within an executing workflow:

  1. Workflow Entry Point: Workflow entry points have full access queues including creating, closing, reading, writing, and fetching the length.
  2. Workflow Signal: Workflow signal methods have partial access to queues including closing, writing, and fetching the length. Signals cannot create or read from queues.
See Also