Table of Contents

Class BackgroundWorkExtensions

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

Queues background work from a message.

public static class BackgroundWorkExtensions
Inheritance
BackgroundWorkExtensions
Inherited Members

Methods

QueueBackgroundWorkAsync(MessageContext, Func<BackgroundWork, Task>)

Queues work that replies into this message's conversation, from the receiving account.

public static ValueTask QueueBackgroundWorkAsync(this MessageContext context, Func<BackgroundWork, Task> work)

Parameters

context MessageContext

The message.

work Func<BackgroundWork, Task>

The work; resolve services from Services.

Returns

ValueTask

A task that completes when the work was queued.

Examples

await Context.Message.QueueBackgroundWorkAsync(async work =>
{
    var report = await work.Services.GetRequiredService<IReportService>().BuildAsync(work.CancellationToken);
    await work.ReplyAsync(report);
});