SquidStd.Messaging
0.27.0
dotnet add package SquidStd.Messaging --version 0.27.0
NuGet\Install-Package SquidStd.Messaging -Version 0.27.0
<PackageReference Include="SquidStd.Messaging" Version="0.27.0" />
<PackageVersion Include="SquidStd.Messaging" Version="0.27.0" />
<PackageReference Include="SquidStd.Messaging" />
paket add SquidStd.Messaging --version 0.27.0
#r "nuget: SquidStd.Messaging, 0.27.0"
#:package SquidStd.Messaging@0.27.0
#addin nuget:?package=SquidStd.Messaging&version=0.27.0
#tool nuget:?package=SquidStd.Messaging&version=0.27.0
<h1 align="center">SquidStd.Messaging</h1>
In-memory transport for SquidStd.Messaging. Provides channel-backed IQueueProvider and ITopicProvider
implementations behind the shared IMessageQueue / IMessageTopic facades: per-queue buffering,
round-robin (competing-consumers) delivery, retry and dead-letter handling, topic fan-out, and metrics -
all registered with a single AddInMemoryMessaging() call.
Queues deliver each message to exactly one subscriber; topics fan every message out to all subscribers.
The contracts live in SquidStd.Messaging.Abstractions, so code written against IMessageQueue and
IMessageTopic moves unchanged to a real broker: use this in-memory provider for single-process apps,
tests, and local dev, then swap in SquidStd.Messaging.RabbitMq or SquidStd.Messaging.Sqs for
production.
Install
dotnet add package SquidStd.Messaging
Usage
Register through the bootstrap - the providers are ISquidStdServices, so StartAsync / StopAsync
manage their lifecycle for you:
using SquidStd.Messaging.Abstractions.Interfaces;
using SquidStd.Messaging.Extensions;
using SquidStd.Services.Core.Extensions;
using SquidStd.Services.Core.Services.Bootstrap;
var bootstrap = SquidStdBootstrap.Create(o => o.ConfigName = "myapp");
bootstrap.ConfigureServices(c => c.RegisterCoreServices().AddInMemoryMessaging());
await bootstrap.StartAsync();
Queues (competing consumers)
Each queue message goes to exactly one subscriber. Implement a listener and subscribe it; dispose the subscription to unsubscribe.
public sealed record OrderPlaced(string Id);
public sealed class OrderListener : IQueueMessageListenerAsync<OrderPlaced>
{
public Task HandleAsync(OrderPlaced message, CancellationToken cancellationToken)
{
Console.WriteLine($"queue handled {message.Id}");
return Task.CompletedTask;
}
}
var queue = bootstrap.Resolve<IMessageQueue>();
using (queue.Subscribe("orders", new OrderListener()))
{
await queue.PublishAsync("orders", new OrderPlaced("order-1"));
}
A synchronous IQueueMessageListener<TMessage> overload of Subscribe is also available.
Topics (fan-out)
Every subscriber receives every message published to the topic.
var topic = bootstrap.Resolve<IMessageTopic>();
using (topic.Subscribe<OrderPlaced>("order-events", (order, _) =>
{
Console.WriteLine($"topic saw {order.Id}");
return Task.CompletedTask;
}))
{
await topic.PublishAsync("order-events", new OrderPlaced("order-2"));
}
Configuration
AddInMemoryMessaging takes an optional MessagingOptions. Options are code-only - this package
registers no YAML config section.
c.AddInMemoryMessaging(new MessagingOptions
{
MaxDeliveryAttempts = 5,
DeadLetterQueueSuffix = ".dead",
RetryDelay = TimeSpan.FromMilliseconds(250)
});
| Property | Default | Purpose |
|---|---|---|
MaxDeliveryAttempts |
3 |
Delivery attempts before a message is dead-lettered. |
DeadLetterQueueSuffix |
".dlq" |
Suffix appended to a queue name to form its dead-letter queue. |
RetryDelay |
Zero |
Delay before a failed message is re-enqueued. |
A connection-string overload is also available:
AddInMemoryMessaging("memory://local?maxDeliveryAttempts=5&retryDelayMs=250&deadLetterSuffix=.dead").
When a listener throws, the message is re-enqueued (after RetryDelay) until MaxDeliveryAttempts is
reached, then moved to <queue><DeadLetterQueueSuffix> - subscribe to that queue to inspect failures.
MessagingMetricsProvider is registered as IMessagingMetrics / IMetricProvider and tracks published,
delivered, retried, failed, and dead-lettered counts per queue.
Key types
| Type | Purpose |
|---|---|
MessagingRegistrationExtensions |
AddInMemoryMessaging(...) registration. |
InMemoryQueueProvider |
Channel-based in-memory IQueueProvider with retry/DLQ. |
InMemoryTopicProvider |
In-memory ITopicProvider (fan-out). |
IMessageQueue / IMessageTopic |
Typed facades from SquidStd.Messaging.Abstractions. |
MessagingOptions |
Retry, dead-letter, and delivery-attempt configuration. |
Related
- Article: Messaging
- Article: Messaging abstractions
- Tutorial: Messaging
- Production transports: SquidStd.Messaging.RabbitMq, SquidStd.Messaging.Sqs
License
MIT - part of SquidStd.
| 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
- DryIoc.dll (>= 5.4.3)
- SquidStd.Core (>= 0.27.0)
- SquidStd.Messaging.Abstractions (>= 0.27.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.27.0 | 0 | 7/7/2026 |
| 0.26.0 | 0 | 7/7/2026 |
| 0.25.0 | 48 | 7/6/2026 |
| 0.24.1 | 48 | 7/6/2026 |
| 0.24.0 | 52 | 7/6/2026 |
| 0.23.0 | 50 | 7/4/2026 |
| 0.22.0 | 49 | 7/4/2026 |
| 0.21.0 | 52 | 7/3/2026 |
| 0.20.0 | 53 | 7/3/2026 |
| 0.19.0 | 63 | 7/3/2026 |
| 0.18.0 | 52 | 7/3/2026 |
| 0.17.0 | 53 | 7/3/2026 |
| 0.16.0 | 56 | 7/3/2026 |
| 0.15.0 | 60 | 7/2/2026 |
| 0.14.1 | 55 | 7/2/2026 |
| 0.14.0 | 51 | 7/2/2026 |
| 0.13.0 | 50 | 7/2/2026 |
| 0.12.0 | 51 | 7/2/2026 |
| 0.11.0 | 55 | 7/2/2026 |
| 0.10.0 | 83 | 6/30/2026 |