Background job queue for slow work
- Dominant language
- C#
- Stars
- 6
- Forks
- 7
- Avg merge
- 4h 42m
- Merged PRs (30d)
- 307
Description
Several things currently happen inline on a request that should not: sending email, building a search index, running a workflow action. A slow or failing third party makes the user wait, or fails a write that had already succeeded.
FastEndpoints has a job queue with a pluggable storage provider, and Marten is a natural backing store:
```csharp
bld.Services.AddJobQueues();
app.UseJobQueues();
await new SendEmailCommand { ... }.QueueJobAsync();
```
**Scope**
- A Marten-backed storage provider so jobs survive a restart
- Move email sending and AI indexing onto it first — both are slow and both are currently best-effort inline
- Somewhere in the admin to see failed jobs, because a silent queue is worse than no queue
**Design note**
Enqueueing must be part of the same transaction as the write that caused it, or you get jobs for content that was rolled back, and content with no job. Marten makes that possible; it will not happen by accident.
Docs:
Contributor guide
Assessment
This issue has not been assessed yet.