Table of Contents

Interface IBackgroundWorkQueue

Namespace
Signal.Application.Background
Assembly
Signal.Application.dll

Runs work outside the conversation partition that received a message, so a slow command does not hold up the messages after it. Items run concurrently (MaxConcurrency), each in its own DI scope.

public interface IBackgroundWorkQueue

Remarks

Items are processed by the hosted service registered with AddSignal. Items still queued at shutdown are dropped (and logged), so don't use the queue for work that must survive restarts.

Methods

QueueAsync(BackgroundWorkItem, CancellationToken)

Queues work. Waits while the queue is full (Capacity).

ValueTask QueueAsync(BackgroundWorkItem item, CancellationToken cancellationToken = default)

Parameters

item BackgroundWorkItem

The work.

cancellationToken CancellationToken

Cancels waiting for space in the queue.

Returns

ValueTask

A task that completes when the item was queued (not when it ran).