Class AsyncQueueTracker
Singleton registry that tracks all IAsyncQueueInstance instances created by the DI container.
Inherited Members
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.