Interface IDelayedAsyncQueue<TItem>
Interface implemented by NetServer's AsyncQueue
Inherited Members
Namespace: SuperOffice.Threading
Assembly: SoCore.dll
Syntax
public interface IDelayedAsyncQueue<TItem> : IAsyncQueueBase<DelayedItem<TItem>>
Type Parameters
Name | Description |
---|---|
TItem | Item to add to the queue |
Methods
Enqueue(TItem, Task)
Enwueue an item to the queue, and schedule it to be executed after a prerequisite task is completed.
Declaration
void Enqueue(TItem item, Task prerequisiteTask)
Parameters
Type | Name | Description |
---|---|---|
TItem | item | Item to be processed. |
Task | prerequisiteTask | Task that must be completed before the item is processed. |
Enqueue(TItem, TimeSpan)
Interface implemented by NetServer's AsyncQueue
Declaration
void Enqueue(TItem item, TimeSpan delay)
Parameters
Type | Name | Description |
---|---|---|
TItem | item | |
TimeSpan | delay |
Requeue(IAsyncQueueProcessItemContext<DelayedItem<TItem>>, Task)
Add back the item being processed to the end of queue, for a retry attempt
Declaration
void Requeue(IAsyncQueueProcessItemContext<DelayedItem<TItem>> context, Task prerequisiteTask)
Parameters
Type | Name | Description |
---|---|---|
IAsyncQueueProcessItemContext<DelayedItem<TItem>> | context | Context that needs the be requeued |
Task | prerequisiteTask | Task that must be completed before the item is processed again. |
Remarks
This method is intended to be called from within the AsyncQueueProcessItemAsync<TItem> delegate. When an item is being processed, it is removed from the queue and added to a currently being processed list. When processing has been completed, it is removed from this list as well. When WaitForItemsInQueueToBeProcessedAsync is calledm, it waits for all items in the queue and items being processed. We thus need to add the item back in the queue, without the internal signaling task comleting, so we ignore retry attempts when waiting.
Requeue(IAsyncQueueProcessItemContext<DelayedItem<TItem>>, TimeSpan)
Interface implemented by NetServer's AsyncQueue
Declaration
void Requeue(IAsyncQueueProcessItemContext<DelayedItem<TItem>> context, TimeSpan delay)
Parameters
Type | Name | Description |
---|---|---|
IAsyncQueueProcessItemContext<DelayedItem<TItem>> | context | |
TimeSpan | delay |