Streamline.Messaging
1.0.7
dotnet add package Streamline.Messaging --version 1.0.7
NuGet\Install-Package Streamline.Messaging -Version 1.0.7
<PackageReference Include="Streamline.Messaging" Version="1.0.7" />
<PackageVersion Include="Streamline.Messaging" Version="1.0.7" />
<PackageReference Include="Streamline.Messaging" />
paket add Streamline.Messaging --version 1.0.7
#r "nuget: Streamline.Messaging, 1.0.7"
#:package Streamline.Messaging@1.0.7
#addin nuget:?package=Streamline.Messaging&version=1.0.7
#tool nuget:?package=Streamline.Messaging&version=1.0.7
Streamline.Messaging
A lightweight and elegant abstraction over NATS for .NET — ideal for fast integration between services without boilerplate code or bloated configuration.
Forget about verbose setups. Just tell the system what message you're handling or producing, and Streamline.Messaging takes care of the rest.
Not Kafka. Not RabbitMQ.
Just a clean, minimal messaging layer for developers who care about writing readable and maintainable code.
📦 Features
- Simple & intuitive usage
- Easy message handler registration
- Publish/Subscribe with queues or topics
- Fast to integrate and great for learning messaging in microservices
✨ Getting Started
1. Install via NuGet
dotnet add package Streamline.Messaging
2. Define a Message
public sealed record OrderCreatedEvent(string OrderId) : IMessage;
3. Create a Message Handler
public sealed class OrderCreatedHandler(IOrderService service):
IMessageHandler<OrderCreatedEvent>
{
public async Task HandleAsync(OrderCreatedEvent message, CancellationToken token = default)
{
Console.WriteLine($"Handling order: {message.OrderId}");
}
}
4. Configure Consumers and Producers
Inside your Program.cs
builder.Services.AddMessaging(options =>
{
options.AddConsumer<OrderCreatedEvent, OrderCreatedHandler>()
.FromQueue("orders.created"); // You can also use .FromTopic("some.topic") if preferred.
options.AddProducer<OrderCreatedEvent>()
.ToTopic("orders.created");
});
5. Publish a Message
public sealed class SampleHandler(IMessageProducer messageProducer) :
IRequestHandler<OrderCreationRequest, Result>
{
public async Task<Result> HandleAsync(OrderCreationRequest request, CancellationToken token)
{
var @event = new OrderCreatedEvent
{
OrderId = "order_XXXXXXXXX"
};
// You can also pass the cancellation token if needed:
// await messageProducer.PublishAsync(@event, token);
await messageProducer.PublishAsync(@event);
return Result.Success();
}
}
⚠️ Note About Abstractions
If you prefer to keep your domain and application layers decoupled from infrastructure, or are following Clean Architecture principles, consider using the separate package:
Streamline.Messaging.Abstractions
This package provides only the messaging interfaces and contracts — no implementation. Perfect for defining messaging contracts in shared libraries, writing unit tests, and keeping your domain clean.
Installation
You can install the abstractions package via NuGet:
dotnet add package Streamline.Messaging.Abstractions
| 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.Hosting (>= 9.0.7)
- NATS.Client (>= 1.1.8)
- Streamline.Messaging.Abstractions (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.