Pluggable foundation blocks for building loosely coupled distributed apps.
- π Pluggable implementations - Swap Redis, Azure, AWS, or in-memory with no code changes
- π§ͺ Developer friendly - In-memory implementations for fast local development and testing
- π DI native - Built for Microsoft.Extensions.DependencyInjection
- π― Interface-first - Code against abstractions, not implementations
- β‘ Production ready - Battle-tested in high-scale applications
- π Consistent APIs - Same patterns across caching, queues, storage, and more
| Feature | Description |
|---|---|
| Caching | In-memory, Redis, and hybrid caching with automatic invalidation |
| Queues | Reliable message queuing with Redis, Azure, AWS SQS |
| Locks | Distributed locking and throttling |
| Messaging | Pub/sub with Redis, RabbitMQ, Kafka, Azure Service Bus |
| Jobs | Background job processing with queue integration |
| File Storage | Unified file API for disk, S3, Azure Blob, and more |
| Resilience | Retry policies, circuit breakers, and timeouts |
dotnet add package Foundatio.RabbitMQ// Messaging
IMessageBus messageBus = new RabbitMQMessageBus(o => o
.ConnectionString("amqp://localhost"));
await messageBus.PublishAsync(new MyMessage { Data = "Hello" });| Provider | Caching | Queues | Messaging | Storage | Locks |
|---|---|---|---|---|---|
| In-Memory | β | β | β | β | β |
| Redis | β | β | β | β | β |
| Azure Storage | β | β | |||
| Azure Service Bus | β | β | |||
| AWS (S3/SQS/SNS) | β | β | β | ||
| RabbitMQ | β | ||||
| Kafka | β | ||||
| Minio | β | ||||
| Aliyun | β | ||||
| SFTP | β |
Foundatio.RabbitMQ supports delayed message delivery via the DeliveryDelay option on PublishAsync.
Current behavior:
- RabbitMQ < 4.3 with plugin installed: If the
rabbitmq_delayed_message_exchangeplugin is detected, it is used for delayed delivery. A warning is logged because the plugin is deprecated and will not work on RabbitMQ 4.3+. - RabbitMQ < 4.3 without plugin: Falls back to an in-memory delay scheduler provided by
MessageBusBase. Messages are held in process memory and delivered after the delay. This is not durable -- delayed messages are lost if the process restarts. - When the RabbitMQ server version is detected as >= 4.3: The plugin probe is skipped (the plugin depends on Mnesia, which was removed in 4.3), and the in-memory fallback is used automatically. If the server version cannot be determined from
ServerProperties["version"], the probe may still be attempted before falling back.
Migration guidance:
The rabbitmq_delayed_message_exchange plugin is archived and no longer maintained. RabbitMQ 4.3 removes Mnesia, making the plugin incompatible. If you rely on delayed messages:
- On RabbitMQ < 4.3: The plugin still works but logs a deprecation warning at startup.
- On RabbitMQ >= 4.3: Delayed messages use the in-memory fallback automatically. Be aware that these are not durable across process restarts.
- For durable delayed delivery on RabbitMQ 4.3+, consider implementing TTL + Dead-Letter Exchange patterns or using an external scheduler.
Supported (AMQP 0.9.1 compatible):
- 32 strict message priority levels on quorum queues (via
UseMessagePriority()) - Delayed retries with linear backoff (via
UseDelayedRetries()) - Per-queue consumer timeouts (via
ConsumerTimeout()) - Single active consumer (via
UseSingleActiveConsumer())
Not supported (require AMQP 1.0 protocol):
x-opt-delivery-timeannotation -- per-message delayed retry override via themodifieddisposition outcome. AMQP 0.9.1basic.nack/basic.rejectdo not support annotations.x-opt-delivery-delayannotation -- relative delay for the enterprise Message Scheduler / Delayed Queue plugin.- Rejected-by and rejection reason -- returned to publishers in the AMQP 1.0
Rejectedoutcome. - Consumer activity notification -- signaled via AMQP 1.0 flow frames for single active consumer state transitions.
This library uses the RabbitMQ.Client package (AMQP 0.9.1). To use AMQP 1.0 features, consider the Amqp.Net Lite library or the RabbitMQ AMQP 1.0 .NET client.
Foundatio automatically propagates W3C trace context (traceparent / tracestate) through message headers. On publish, the current Activity.Id is stored as the message's CorrelationId; on receive, Foundatio starts a new Activity parented to that ID, linking consumer spans back to the publisher's trace.
To collect Foundatio's application-level message spans, add the "Foundatio" source:
.AddSource("Foundatio")For additional transport-level visibility (AMQP channel operations, network round-trips), the RabbitMQ.Client 7.x library emits its own spans:
.AddSource("RabbitMQ.Client.*")A complete tracing setup:
services.AddOpenTelemetry().WithTracing(tracing =>
{
tracing.AddSource("Foundatio"); // message publish/handle spans
tracing.AddSource("RabbitMQ.Client.*"); // AMQP transport spans (optional)
tracing.AddOtlpExporter();
});Note: The
RabbitMQ.Client.OpenTelemetrypackage (currently pre-release) is NOT required -- Foundatio handles cross-process trace propagation at the application level. That package adds an alternative propagation mechanism at the transport level which is redundant when using Foundatio.
- Getting Started - Installation and setup
- Caching - In-memory, Redis, and hybrid caching with invalidation
- Queues - FIFO message delivery with lock renewal and retry policies
- Locks - Distributed locking with null handling patterns
- Messaging - Pub/sub with size limits and notification patterns
- File Storage - Unified file API across providers
- Jobs - Background job processing and hosted service integration
- Resilience - Retry policies, circuit breakers, and timeouts
- Serialization - Serializer configuration and performance
- Dependency Injection - DI setup and patterns
- Configuration - Options and settings
Want the latest CI build before it hits NuGet? Add the Feedz source and install the pre-release version:
dotnet nuget add source https://f.feedz.io/foundatio/foundatio/nuget -n foundatio-feedz
dotnet add package Foundatio.RabbitMQ --prereleaseOr add to your NuGet.config:
<configuration>
<packageSources>
<add key="foundatio-feedz" value="https://f.feedz.io/foundatio/foundatio/nuget" />
</packageSources>
<packageSourceMapping>
<packageSource key="foundatio-feedz">
<package pattern="Foundatio.*" />
</packageSource>
</packageSourceMapping>
</configuration>Contributions are welcome! Please feel free to submit a Pull Request. See our documentation for development guidelines.
Development Setup:
- Clone the repository
- Open
Foundatio.RabbitMQ.slnxin Visual Studio or VS Code - Run
dotnet buildto build - Run
dotnet testto run tests
Apache 2.0 License