Naravel.Notifications.Queue
0.2.0
dotnet add package Naravel.Notifications.Queue --version 0.2.0
NuGet\Install-Package Naravel.Notifications.Queue -Version 0.2.0
<PackageReference Include="Naravel.Notifications.Queue" Version="0.2.0" />
<PackageVersion Include="Naravel.Notifications.Queue" Version="0.2.0" />
<PackageReference Include="Naravel.Notifications.Queue" />
paket add Naravel.Notifications.Queue --version 0.2.0
#r "nuget: Naravel.Notifications.Queue, 0.2.0"
#:package Naravel.Notifications.Queue@0.2.0
#addin nuget:?package=Naravel.Notifications.Queue&version=0.2.0
#tool nuget:?package=Naravel.Notifications.Queue&version=0.2.0
Naravel.Notifications.Queue
Optional Naravel.Notifications adapter that delivers notifications through Naravel.Queue: only a registered alias and a plain payload are stored.
| Fact | Detail |
|---|---|
| Install | dotnet add package Naravel.Notifications.Queue |
| Targets | .NET 10 |
| Needs | Naravel.Notifications and Naravel.Queue, which NuGet installs with it |
| Runs on | a Naravel.Queue driver and a worker that you register |
What you get
- An alias and a payload, nothing else. The queue stores the alias and the payload as JSON: no type name, no notification object, no recipient.
- Fresh data in the worker. The handler gets the deserialized payload and the job's service scope, so it loads the recipient from your own services and builds the notification itself.
- Mistakes fail early. Queueing an unregistered alias, or a payload of another type than the registered one, throws at once, and registering one alias twice is refused.
- Placement in one place.
AddNaravelNotificationQueue(options => ...)setsConnectionandQueue; both default to the queue module's defaults.
Quick start
builder.Services.AddNaravelNotificationQueue(); // plus AddQueue, a queue driver and, in worker processes, AddQueueWorker
builder.Services.AddQueuedNotification<InvoicePayload>("invoice.ready", async (payload, scope, ct) =>
{
var user = await scope.GetRequiredService<IUserRepository>().FindAsync(payload.UserId, ct); // fresh data
await scope.GetRequiredService<INotificationSender>().SendAsync(user, new InvoiceReady(payload.InvoiceId), ["mail"], ct);
});
await notificationQueue.QueueAsync("invoice.ready", new InvoicePayload(user.Id, 7), ct); // INotificationQueue
InvoicePayload, InvoiceReady, IUserRepository and user are your own types and objects, and notificationQueue is an injected INotificationQueue. Never rename an alias while jobs that use it are queued.
Related packages
| Package | Adds |
|---|---|
Naravel.Notifications |
One typed notification to a recipient through the channels you name |
Naravel.Queue |
Jobs, retries and the background worker that run the handler |
Learn more
- Notifications: English guide
- Queue: English guide
- Changelog · Source and issues · MIT license
Part of Naravel: Laravel's names, .NET's type system. All Naravel packages share one version.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Naravel.Notifications (>= 0.2.0)
- Naravel.Queue (>= 0.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Release notes: https://github.com/km-arc/Naravel/releases/tag/v0.2.0 - full history: https://github.com/km-arc/Naravel/blob/main/CHANGELOG.md