Class BackgroundTaskQueue
A Background Task Queue, to enqueue tasks for executing in the background.
Inheritance
System.Object
Namespace: Umbraco.Cms.Infrastructure.HostedServices
Assembly: Umbraco.Infrastructure.dll
Syntax
public class BackgroundTaskQueue : IBackgroundTaskQueue
Remarks
Borrowed from https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-5.0
Methods
View SourceDequeueAsync(CancellationToken)
Dequeue the first item on the queue.
Declaration
public async Task<Func<CancellationToken, Task>?> DequeueAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<System.Nullable<Func<CancellationToken, Task>>> |
QueueBackgroundWorkItem(Func<CancellationToken, Task>)
Enqueue a work item to be executed on in the background.
Declaration
public void QueueBackgroundWorkItem(Func<CancellationToken, Task> workItem)
Parameters
Type | Name | Description |
---|---|---|
Func<CancellationToken, Task> | workItem |