Show / Hide Table of Contents

Class AsyncQueueTracker

Singleton registry that tracks all IAsyncQueueInstance instances created by the DI container.

Inheritance
object
AsyncQueueTracker
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.Threading
Assembly: SoCore.dll
Syntax
public class AsyncQueueTracker
Remarks

Each AsyncQueueBase<TItem> self-registers with this tracker upon construction, making it possible to enumerate all concrete queue instances at runtime even though they are registered as open generics.

Constructors

AsyncQueueTracker()

Singleton registry that tracks all IAsyncQueueInstance instances created by the DI container.

Declaration
public AsyncQueueTracker()
Remarks

Each AsyncQueueBase<TItem> self-registers with this tracker upon construction, making it possible to enumerate all concrete queue instances at runtime even though they are registered as open generics.

Methods

GetAll()

Get all registered queue instances.

Declaration
public IReadOnlyCollection<IAsyncQueueInstance> GetAll()
Returns
Type Description
IReadOnlyCollection<IAsyncQueueInstance>

A snapshot of all tracked queue instances.

Remarks

Each AsyncQueueBase<TItem> self-registers with this tracker upon construction, making it possible to enumerate all concrete queue instances at runtime even though they are registered as open generics.

WaitForAllQueuesAsync(CancellationToken)

Iteratively wait for all tracked queues to be fully drained.

Declaration
public Task WaitForAllQueuesAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

Draining one queue may cause items to be enqueued in another queue, so this method repeats until every queue reports HasItemsInTheQueue as false.

WaitForInFlightItemsAsync(CancellationToken)

Wait for items that are currently being processed (in-flight) across all tracked queues. Does NOT wait for items still sitting in queues, making it safe to call after processors have been stopped.

Declaration
public Task WaitForInFlightItemsAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task
Remarks

Each AsyncQueueBase<TItem> self-registers with this tracker upon construction, making it possible to enumerate all concrete queue instances at runtime even though they are registered as open generics.

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
ObjectExtensions.AssignByReflection<T>(T, T)
ObjectExtensions.GraphCopy<T>(T)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top