Runax.Messaging.Transports.RabbitMq
2.0.0
dotnet add package Runax.Messaging.Transports.RabbitMq --version 2.0.0
NuGet\Install-Package Runax.Messaging.Transports.RabbitMq -Version 2.0.0
<PackageReference Include="Runax.Messaging.Transports.RabbitMq" Version="2.0.0" />
<PackageVersion Include="Runax.Messaging.Transports.RabbitMq" Version="2.0.0" />
<PackageReference Include="Runax.Messaging.Transports.RabbitMq" />
paket add Runax.Messaging.Transports.RabbitMq --version 2.0.0
#r "nuget: Runax.Messaging.Transports.RabbitMq, 2.0.0"
#:package Runax.Messaging.Transports.RabbitMq@2.0.0
#addin nuget:?package=Runax.Messaging.Transports.RabbitMq&version=2.0.0
#tool nuget:?package=Runax.Messaging.Transports.RabbitMq&version=2.0.0
Runax.Messaging.Transports.RabbitMq
RabbitMQ transport for Runax.Messaging. Topics map to routing keys on a topic exchange.
Built against
RabbitMQ.Client7.x (the asynchronousIChannelAPI).
Install
dotnet add package Runax.Messaging
dotnet add package Runax.Messaging.Transports.RabbitMq
Register
Attach the transport to a bus with its config object:
using Runax.Messaging;
using Runax.Messaging.Transports.RabbitMq;
builder.Services.AddRunaxMessaging(messaging =>
{
messaging.AddBus(bus =>
{
bus.AddTransport(new RabbitMqConfig
{
HostName = "localhost",
});
bus.AddConsumer<OrderPlacedConsumer>();
});
});
RabbitMqConfig lives in the Runax.Messaging.Transports.RabbitMq namespace, so add that using.
The config is validated at startup (DataAnnotations, when the AddBus block completes); bind it
from an IConfiguration section instead of setting properties:
bus.AddTransport<RabbitMqConfig>(builder.Configuration.GetSection("RabbitMq")).
Config
Set these directly on RabbitMqConfig.
| Property | Meaning | Default | Required? |
|---|---|---|---|
HostName |
RabbitMQ host. Ignored when Uri is set. |
localhost |
No |
Port |
RabbitMQ port. Ignored when Uri is set. |
5672 |
No |
UserName |
Username. Ignored when Uri is set. |
guest |
No |
Password |
Password. Prefer Uri (an amqps:// string) or a secret store. Ignored when Uri is set. |
guest |
No |
VirtualHost |
Virtual host. Ignored when Uri is set. |
/ |
No |
Uri |
Full AMQP connection URI (e.g. amqps://user:pass@host:5671/vhost). Takes precedence over the discrete settings and enables TLS for the amqps scheme. |
null |
No |
UseTls |
Enable TLS when connecting via the discrete host settings (not Uri). |
false |
No |
SslServerName |
TLS server name (SNI) when UseTls is on. Defaults to HostName. |
null |
No |
ExchangeName |
Exchange to publish to and bind against. | runax.messaging |
No |
ExchangeType |
Exchange type. | topic |
No |
PrefetchCount |
Unacknowledged messages allowed in flight per consumer (BasicQos). |
10 |
No |
PublisherConfirms |
Wait for broker acknowledgement of each publish. | true |
No |
ConfirmTimeout |
How long to wait for a publisher confirm before failing. | 5s |
No |
PublishChannelPoolSize |
Size of the publish channel pool; larger allows more concurrent publishes. | 5 |
No |
DeadLetterExchange |
Dead-letter exchange for broker-native dead-lettering. When set, consumer queues are declared with x-dead-letter-exchange. |
null |
No |
DeadLetterExchangeType |
Type of the declared DeadLetterExchange. |
topic |
No |
RegisterHealthCheck |
Auto-register the runax:{bus} health check (inherited from TransportConfig). |
true |
No |
Beyond the transport config, settings from the core package apply to the bus that runs this
transport — AddConsumer<T>(), WithRetry(...), OnUnroutableMessage(...),
ConfigureSerialization(...), and UseSerializer<T>() — all inside the same AddBus block.
Two RabbitMQ clusters are simply two buses, each with its own RabbitMqConfig. See
Configuration & per-bus settings.
Behavior
- Publish sends the serialized envelope to
ExchangeNameusing the topic as the routing key, with persistent delivery. Publishes fan out across a pool of channels (PublishChannelPoolSize) and, whenPublisherConfirmsis on, wait for broker confirmation. Automatic and topology recovery are enabled. AConsumeOnlybus creates no publish channel pool. - Batch publish (
PublishBatchAsync) publishes all envelopes on one channel and waits for a single confirm for the whole batch instead of one per message. - Subscribe declares an exclusive, auto-delete queue (with
BasicQosprefetch), binds it to each topic, and maps the dispatch verdict to the broker:Acknowledge→basic.ackRequeue→basic.nackwith requeueDeadLetter→basic.nackwithout requeue, routed toDeadLetterExchangewhen configured (otherwise dropped by the broker)
To use RabbitMQ's native dead-lettering, set DeadLetterExchange and configure
bus.WithRetry(o => o.Strategy = DeadLetterStrategy.BrokerNative) on the bus.
Health check
A broker-reachability check named runax:{bus} is registered automatically for each bus that
runs this transport. Opt out per bus:
bus.AddTransport(new RabbitMqConfig { HostName = "localhost", RegisterHealthCheck = false });
Telemetry
The transport reports messaging.system = "rabbitmq" on the spans and metrics
emitted by the core package (activity source / meter "Runax.Messaging"); the
messaging.runax.bus tag identifies the bus.
License
MIT
| 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
- Microsoft.Extensions.Configuration (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.10)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.10)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.10)
- RabbitMQ.Client (>= 7.2.2)
- Runax.Messaging.Abstractions (>= 2.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.