Akka.Streams.Amqp.RabbitMq
1.5.74
Prefix Reserved
dotnet add package Akka.Streams.Amqp.RabbitMq --version 1.5.74
NuGet\Install-Package Akka.Streams.Amqp.RabbitMq -Version 1.5.74
<PackageReference Include="Akka.Streams.Amqp.RabbitMq" Version="1.5.74" />
<PackageVersion Include="Akka.Streams.Amqp.RabbitMq" Version="1.5.74" />
<PackageReference Include="Akka.Streams.Amqp.RabbitMq" />
paket add Akka.Streams.Amqp.RabbitMq --version 1.5.74
#r "nuget: Akka.Streams.Amqp.RabbitMq, 1.5.74"
#:package Akka.Streams.Amqp.RabbitMq@1.5.74
#addin nuget:?package=Akka.Streams.Amqp.RabbitMq&version=1.5.74
#tool nuget:?package=Akka.Streams.Amqp.RabbitMq&version=1.5.74
Akka.Streams.Amqp.RabbitMq
RabbitMQ AMQP 0-9-1 sources, publishing sinks/flows and request/reply flows for Akka.NET Streams. This package uses RabbitMQ.Client 6 and targets .NET Standard 2.0 and .NET 6. For the separate AMQP 1.0 connector, see Akka.Streams.Amqp.V1.
dotnet add package Akka.Streams.Amqp.RabbitMq
Publish with broker confirms
Set RABBITMQ_URI to a broker URI such as amqp://guest:guest@localhost:5672/. Both examples use the same durable orders queue. Existing queues must have matching declaration properties.
using Akka.Actor;
using Akka.IO;
using Akka.Streams;
using Akka.Streams.Amqp.RabbitMq;
using Akka.Streams.Amqp.RabbitMq.Dsl;
using Akka.Streams.Dsl;
var system = ActorSystem.Create("rabbitmq-publisher");
try
{
var connection = AmqpConnectionUri.Create(new Uri(
Environment.GetEnvironmentVariable("RABBITMQ_URI")
?? throw new InvalidOperationException("Set RABBITMQ_URI.")));
var sink = AmqpSink.CreateSimple(AmqpSinkSettings.Create(connection)
.WithRoutingKey("orders")
.WithDeclarations(QueueDeclaration.Create("orders").WithDurable(true))
.WithWaitForConfirms(TimeSpan.FromSeconds(5)));
await Source.From(new[] { "first", "second", "third" })
.Select(ByteString.FromString)
.RunWith(sink, system.Materializer());
}
finally { await system.Terminate(); }
AmqpSink.CreateSimple accepts ByteString; AmqpSink.Create accepts OutgoingMessage with routing key, mandatory flag and RabbitMQ IBasicProperties. Both materialize a completion Task. Publisher confirms are opt-in through WithWaitForConfirms(timeout) and wait synchronously after each publish. A broker confirmation does not mean an application consumer has processed the message. Without confirms, task completion establishes that the stage issued its publishes, not confirmed broker acceptance. The Immediate constructor argument on OutgoingMessage is retained for compatibility; the connector does not send an AMQP immediate flag.
Use AmqpFlow.Create<TPassThrough> to publish (OutgoingMessage, TPassThrough) and emit each pass-through value after the corresponding publish/optional confirmation. Its materialized Task reports publisher completion. A durable queue alone does not make messages persistent; use persistent delivery properties on OutgoingMessage when needed.
Process before acknowledging
AmqpSource.CommittableSource(settings, bufferSize) emits CommittableIncomingMessage with Message, Ack(multiple: false) and Nack(multiple: false, requeue: true). The message exposes payload bytes, delivery envelope and RabbitMQ properties. Keep acknowledgment-required mode enabled when using those operations.
This complete example consumes and acknowledges three messages, then completes. Run the publisher first against the same broker/queue.
using Akka;
using Akka.Actor;
using Akka.Streams;
using Akka.Streams.Amqp.RabbitMq;
using Akka.Streams.Amqp.RabbitMq.Dsl;
using Akka.Streams.Dsl;
var system = ActorSystem.Create("rabbitmq-consumer");
try
{
var connection = AmqpConnectionUri.Create(new Uri(
Environment.GetEnvironmentVariable("RABBITMQ_URI")
?? throw new InvalidOperationException("Set RABBITMQ_URI.")));
var settings = NamedQueueSourceSettings.Create(connection, "orders")
.WithDeclarations(QueueDeclaration.Create("orders").WithDurable(true));
await AmqpSource.CommittableSource(settings, bufferSize: 10)
.Take(3)
.SelectAsync(1, async delivery =>
{
Console.WriteLine(delivery.Message.Bytes.ToString(System.Text.Encoding.UTF8));
await delivery.Ack();
return Done.Instance;
})
.RunWith(Sink.Ignore<Done>(), system.Materializer());
}
finally { await system.Terminate(); }
An acknowledgment completes after the client sends the broker acknowledgment operation; it is not a distributed transaction with your application effects. Failures can cause redelivery, so make processing safe to repeat. Use multiple: true only when all earlier delivery tags on the same channel are ready to settle. A Nack with requeue: false rejects the delivery; dead-lettering depends on broker configuration.
AmqpSource.AtMostOnceSource acknowledges before emitting IncomingMessage downstream. A downstream failure can therefore lose that message. TemporaryQueueSourceSettings creates a broker-named temporary queue bound to the configured exchange/routing key. Declarations, routing and acknowledgment semantics still belong to RabbitMQ; the connector does not provide exactly-once processing.
Each materialized stage creates and owns its connection and channel. Sources use broker prefetch and a bounded stage queue; stream stages can add further buffering. A committable source keeps its connection alive after downstream cancellation until already emitted deliveries are acknowledged or rejected. Retain those delivery handles and settle them, including explicit requeue where appropriate; cancellation alone does not promise immediate connection release. Terminating the ActorSystem forcibly ends its streams and permits broker recovery of unsettled messages.
Request/reply
AmqpRpcFlow.CreateSimple accepts/emits ByteString; CommittableFlow uses OutgoingMessage and CommittableIncomingMessage. The materialized Task<string> supplies a private exclusive reply queue name. The flow puts that name into outgoing ReplyTo properties. A responder can preserve those properties and publish with AmqpSink.ReplyTo(AmqpReplyToSinkSettings.Create(connection)).
repliesPerMessage defaults to one. An outgoing expectedReplies header can override that count. Supply the expected replies or cancel/terminate the stream; there is no automatic request timeout. A responder receiving from a queue is an ongoing stream: bound it explicitly when a test or finite application expects its completion. Requests/replies are not automatically correlated by an application request identifier.
Broker and driver compatibility
QueueDeclaration.Create(name) retains its existing defaults: non-durable, non-exclusive, not auto-delete. RabbitMQ 4.3+ rejects that combination by default. Prefer an explicit durable queue, as above, or a suitable exclusive temporary queue. Existing deployments using transient non-exclusive queues need the broker's documented deprecated_features.permit.transient_nonexcl_queues = true setting while that feature remains supported. See RabbitMQ queue durability. This package does not silently change existing queue properties.
RabbitMQ.Client 7 changes public driver types and asynchronous APIs; it is not a drop-in runtime replacement for this package's version 6 API. Configure credentials, virtual host, TLS and recovery using AmqpConnectionDetails or AmqpConnectionUri as appropriate. Broker restarts, permissions and topology recovery need deployment-specific validation.
Tests
With Docker running, from the repository root:
dotnet test src/Amqp/Akka.Streams.Amqp.RabbitMq.Tests/Akka.Streams.Amqp.RabbitMq.Tests.csproj -c Release --framework net10.0
The Testcontainers.RabbitMq fixture pins RabbitMQ 4.4.0, discovers its endpoint, bounds startup and owns cleanup. Its compatibility setting keeps the original default-queue contracts exercised. A separate stock-broker case observes rejection of legacy defaults, durable-queue native-client interoperability and explicit requeue after cancellation. A blocked-broker case keeps a confirmed publish pending until the broker accepts it. The suite includes routing, acknowledgments, rejection and the three formerly skipped RPC cases. Missing Docker or broker startup failures fail the tests. These local single-broker checks do not establish cluster recovery or production throughput.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Akka.Streams (>= 1.5.74)
- RabbitMQ.Client (>= 6.8.1)
-
net6.0
- Akka.Streams (>= 1.5.74)
- RabbitMQ.Client (>= 6.8.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Akka.Streams.Amqp.RabbitMq:
| Package | Downloads |
|---|---|
|
MJ.Akka.EventReactor.RabbitMq
Package Description |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Akka.Streams.Amqp.RabbitMq:
| Repository | Stars |
|---|---|
|
petabridge/akkadotnet-code-samples
Akka.NET professional reference code samples
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.5.74 | 75 | 11/13/2026 |
| 1.5.59 | 7,415 | 1/27/2026 |
| 1.5.57 | 139,291 | 12/23/2025 |
| 1.5.40 | 5,965 | 4/18/2025 |
| 1.5.37 | 6,346 | 1/23/2025 |
| 1.5.33 | 1,105 | 12/26/2024 |
| 1.5.28 | 2,976 | 9/9/2024 |
| 1.5.18 | 199,292 | 3/29/2024 |
| 1.5.15 | 1,143 | 1/11/2024 |
| 1.5.8 | 2,473 | 6/30/2023 |
| 1.5.7 | 112,686 | 5/31/2023 |
| 1.5.0.1 | 1,515 | 3/7/2023 |
| 1.5.0 | 530 | 3/3/2023 |
| 1.4.49 | 3,820 | 3/3/2023 |
| 1.0.1-beta4 | 1,253 | 10/21/2022 |
| 1.0.1-beta3 | 6,889 | 10/21/2022 |
| 1.0.1-beta2 | 530 | 7/25/2022 |
| 1.0.1-beta1 | 358 | 6/8/2022 |
| 1.0.0-beta9 | 64,924 | 3/17/2022 |
| 1.0.0-beta8 | 478 | 12/21/2021 |
* Bump the minimum Akka.NET dependency to [1.5.74](https://github.com/akkadotnet/akka.net/releases/tag/1.5.74), with aligned Streams and TestKit dependencies.
* Include an individual README in each of the twelve connector packages, with usage, ownership, delivery semantics, limitations and linked NuGet version/download badges. Expand the repository README and documentation navigation.
* Update compatible Azure, AWS, AMQP and SignalR dependencies. Package READMEs document remaining SDK support and version limitations.
* Azure Service Bus JSON sources await successful message completion before emitting values and propagate settlement failures.
* Fix SQS batch-response correlation when response entries arrive in a different order.
* Improve SNS and Kinesis completion, cancellation and failure handling.
* Remove blocking SignalR send waits while preserving sequential delivery and existing materialized values.
* Propagate AMQP conversion and connection failures through the materialized completion task.
* Correct CSV parsing across split CRLF/escape sequences and XML parser empty-element/document completion, including reader and feeder cleanup.
* Improve rotating-file sink cleanup on completion and failures.
* Add required service integration, package/API, unchanged-consumer and packaged-example validation. Harden Event Hubs startup and Service Bus polling tests.
* Replace legacy FluentAssertions usages with xUnit assertions, retaining their payload, ordering, exception and deadline checks.
* Mark the historical `Akka.Streams.Channels`, `Akka.Streams.Azure.EventHub.V5` and `Akka.Streams.SignalR.AspNetCore` packages as Legacy on NuGet. See the [migration guide](https://alpakka.getakka.net/documentation/LegacyPackages.html) for their maintained replacements and compatibility requirements.
**Upstream compatibility:** Alpakka retains its public APIs and library targets. Raising the Akka.NET minimum from 1.5.60 inherits upstream binary changes: the old `RetrySupport.Retry` overload with an `int randomFactor` is replaced by a `double` overload, and `ISourceQueue<T>` requires `OfferAsync(T, CancellationToken)`. Applications using that old compiled overload or custom queue implementations need to update and rebuild against the new dependencies.