Sora.Messaging.Core
0.4.0
dotnet add package Sora.Messaging.Core --version 0.4.0
NuGet\Install-Package Sora.Messaging.Core -Version 0.4.0
<PackageReference Include="Sora.Messaging.Core" Version="0.4.0" />
<PackageVersion Include="Sora.Messaging.Core" Version="0.4.0" />
<PackageReference Include="Sora.Messaging.Core" />
paket add Sora.Messaging.Core --version 0.4.0
#r "nuget: Sora.Messaging.Core, 0.4.0"
#:package Sora.Messaging.Core@0.4.0
#addin nuget:?package=Sora.Messaging.Core&version=0.4.0
#tool nuget:?package=Sora.Messaging.Core&version=0.4.0
Sylin.Sora.Messaging.Core
Core messaging abstractions and helpers for Sora: bus configuration, auto-registration, and options binding.
- Target framework: net9.0
- License: Apache-2.0
Install
dotnet add package Sylin.Sora.Messaging.Core
Links
- Messaging reference: https://github.com/sylin-labs/sora-framework/tree/dev/docs/reference
Usage
Declare messages with attributes, then send via extension methods.
using Sora.Messaging;
[Message(Alias = "User.Registered", Version = 1)]
public sealed record UserRegistered(
string UserId,
[Header("x-tenant")] string Tenant,
[IdempotencyKey] string EventId,
[PartitionKey] string Partition,
[DelaySeconds] int DelaySeconds = 0);
// Single send (DefaultBus)
await new UserRegistered("u-123", "acme", "evt-1", "acme:u-123").Send();
// Send to a specific bus
await new UserRegistered("u-456", "acme", "evt-2", "acme:u-456").SendTo("rabbit");
// Batch send
var batch = new object[]
{
new UserRegistered("u-789", "acme", "evt-3", "acme:u-789"),
new UserRegistered("u-790", "acme", "evt-4", "acme:u-790")
};
await batch.Send(); // default bus
await batch.SendTo("rabbit"); // specific bus
Register handlers tersely
// Most concise (no envelope):
builder.Services.On<UserRegistered>(msg => Console.WriteLine($"New user: {msg.UserId}"));
// Async with CancellationToken
builder.Services.On<UserRegistered>((msg, ct) => HandleAsync(msg, ct));
// Keep envelope when needed
builder.Services.OnMessage<UserRegistered>((env, msg, ct) => HandleWithEnvelope(env, msg, ct));
// Intent-signaling aliases
builder.Services.OnEvent<UserRegistered>(msg => IndexUser(msg.UserId));
builder.Services.OnCommand<ReindexAll>(ct => ReindexAsync(ct));
Notes
Send
/SendTo
are defined onMessagingExtensions
and operate per-message when batching.- Headers/correlation/idempotency are promoted from attributes; partitions add a
.p{n}
suffix to routing keys.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net9.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.8)
- Microsoft.Extensions.Options (>= 9.0.8)
- Sora.Core (>= 0.4.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Sora.Messaging.Core:
Package | Downloads |
---|---|
Sora.Messaging.RabbitMq
RabbitMQ transport for Sora Messaging: resilient connection management, config-first options, and inbox integration. |
|
Sora.Messaging.Inbox.Http
HTTP-based inbox store for Sora Messaging: simple and configurable receiver endpoint. |
|
Sora.Messaging.Inbox.InMemory
In-memory inbox store for Sora Messaging: fast local development/testing inbox implementation. |
|
Sora.Flow.Core
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
See release notes: https://github.com/sylin-labs/sora-framework/releases