Flowly.RabbitMQ
1.5.1
See the version list below for details.
dotnet add package Flowly.RabbitMQ --version 1.5.1
NuGet\Install-Package Flowly.RabbitMQ -Version 1.5.1
<PackageReference Include="Flowly.RabbitMQ" Version="1.5.1" />
<PackageVersion Include="Flowly.RabbitMQ" Version="1.5.1" />
<PackageReference Include="Flowly.RabbitMQ" />
paket add Flowly.RabbitMQ --version 1.5.1
#r "nuget: Flowly.RabbitMQ, 1.5.1"
#:package Flowly.RabbitMQ@1.5.1
#addin nuget:?package=Flowly.RabbitMQ&version=1.5.1
#tool nuget:?package=Flowly.RabbitMQ&version=1.5.1
Flowly.RabbitMQ
RabbitMQ transport for Flowly. Swap this for Flowly.AzureServiceBus without changing any handler or sender code.
Quick Start
// Program.cs — connection string key from appsettings.json
builder.AddFlowly(configure => configure
.UseRabbitMq("RabbitMQ")
.AddMessageHandler<OrderCreated, OrderCreatedHandler>()
.AddMessageSubmitter<OrderCreated>());
// appsettings.json
{
"ConnectionStrings": {
"RabbitMQ": "amqp://guest:guest@localhost:5672/"
}
}
The default connection string (amqp://guest:guest@localhost:5672/) is used when no configuration key is provided.
Health Check
builder.AddFlowly(configure => configure
.UseRabbitMq("RabbitMQ", enableHealthCheck: true));
Registers a health check under the tag "rabbitmq".
Retry Topology
Flowly's retry mechanism uses a {queue}.retry queue with RabbitMQ's Dead Letter Exchange. With the default createTopology: true, the retry queue, DLX, and dead letter queue are created automatically at startup. No manual configuration required.
Consumer acknowledgement timeout
RabbitMQ limits how long a delivery may stay unacknowledged (consumer_timeout, 30 minutes by default, configurable on the broker; Flowly has no per-queue setting). How the broker enforces it was observed to depend on the broker version and the queue type (Flowly declares classic queues unless the virtual host's default queue type says otherwise):
- RabbitMQ 3.13.7, classic queue (
x-consumer-timeoutqueue argument): the broker closed the consumer's channel at the timeout. The delivery's cancellation token was cancelled, and the handler kept running. - RabbitMQ 4.4.1, classic queue (
consumer-timeoutpolicy): nothing happened in the 164 seconds observed; the consumer stayed registered and the message stayed unacknowledged. The timeout was not enforced in that window. - RabbitMQ 4.4.1, quorum queue (
consumer-timeoutpolicy): between 62 and 82 seconds the broker cancelled the consumer (the queue's consumer count went to zero and the message returned to ready). The channel stayed open, and the delivery's cancellation token was not observed to be cancelled. With a prefetch above one only the delivery past the timeout was returned; the others stayed on the channel and could still be acknowledged, and when they exceeded the timeout in turn the broker closed the channel, as on RabbitMQ 3.13.7.
Other broker versions and queue types, and a classic queue on RabbitMQ 4.4 beyond 164 seconds, were not observed.
When the broker closes the channel, Flowly logs the broker's reason as an error, naming the acknowledgement timeout only as one possible cause, and resumes consuming the queue on a new channel, retried until it succeeds or the processor is stopped. A failed attempt (for example on a deleted queue) waits 5 seconds before the next one, doubling after each failure up to 5 minutes, and the delay starts again at 5 seconds once consuming has run for 60 seconds; while the consumer connection is down it retries every 5 seconds (one warning per outage) until the connection is open again. Resuming waits for the handlers still running on the closed channel; stopping the processor does not: the closed channel is then released in the background once they return, and a stop whose cancellation token fires (for example the host's shutdown timeout) logs a warning and returns. A channel closed or a consumer cancelled while consuming is being resumed (for example on a deleted queue) is logged as an error with the broker's reply code and text, or the consumer tag, without naming the acknowledgement timeout, and each failed attempt as a warning that it is retried. The handler of the closed delivery sees its cancellation token cancelled. Resuming waits for every handler that is running on the channel being replaced: releasing the closed channel waits until they have returned (observed with one and with four handlers at a time), so a handler that ignores its token delays the resume, and a stop of the processor, until it returns. Meanwhile the broker can deliver the message to another consumer of the queue, so the same message can be handled twice at the same time: handlers must be idempotent. Flowly releases the closed channel before opening the new one because the RabbitMQ client's automatic connection recovery would otherwise restore it, with its consumer, after a lost connection. After a lost connection the client's own recovery restores the consumer and the broker redelivers the unacknowledged messages while the first executions, which ignore their cancelled token, may still run. A redelivered message waits until a handler of the processor is free: each queue, event subscription and execution lane processor runs at most MaxConcurrentCalls handlers at the same time, across connection recoveries too, so with one handler at a time a redelivered message starts only after the first execution has returned. A delivery whose token is cancelled while it waits is not handled; the broker delivers it again. Stopping the processor ends every wait, so a ReceiveAndDelete delivery (such as the trigger of a recurring job) that is waiting when the host stops is not handled. When the broker cancels the consumer and leaves the channel open, Flowly logs the consumer tag as an error (the cancellation carries no reason; an exceeded acknowledgement timeout is one possible cause, a deleted queue another), replaces the channel (closes and disposes it, opens a new one) and restores the consumer on the new channel, with the same growing retry delay; it does not consume on the old channel again, because the client keeps the cancelled consumer recorded there and its connection recovery would restore it next to the new one. A cancellation while the processor stops or is disposed resumes nothing. The broker leaves the channel open, and in the quorum queue observation the running handler's cancellation token was not observed to be cancelled, so expect the handler to go on. Here too resuming waits for the handler that is running on the channel being replaced: the client hands the cancellation over through the same dispatcher as the deliveries, so with one handler at a time, or when every concurrent handler is busy, the replacement starts only after one of them has returned (until then the queue has no consumer in this process), and it then waits for every handler still running on the old channel. The first run's late acknowledgement did not close the channel and did not settle the returned message (RabbitMQ 4.4.1). The message returned to ready, so the broker can deliver it again, to another consumer of the queue (possibly while the first run still goes on) or to the restored consumer once consuming has resumed. Closing the old channel returns every message it has not acknowledged by then to the queue, and the broker delivers those messages again. This covers queue, event and execution lane consumers. The consumer of a stream without [StreamPartitions] (MessageStreamHandler<T>) is recovered the same way and continues on the new channel right after the last message it had handed to the handler's batch buffer, so nothing is skipped; a message whose hand-over was interrupted by the close is delivered again, together with the messages after it. When the channel closed before any message arrived, it attaches again with the configured start position (or the stored checkpoint position), so with StartPosition.Last() messages published while consuming was down are not delivered. Acknowledging a buffered stream message of the closed channel is skipped instead of failing, because on a stream an acknowledgement only returns consumer credit, so the batch does not halt. The consumer of batch handlers (BatchMessageHandler<T>) is recovered the same way: when the broker closes its channel or cancels its consumer, it consumes the queue again on a new channel with the same prefetch, retried every 5 seconds. Messages received on the closed channel are never acknowledged on the new one, so the broker delivers them again: messages still buffered for the next batch are dropped, and the acknowledgement of a batch already handed to the handler is skipped instead of failing, each logged as a warning with the number of messages. A batch whose handler had already run is therefore handled a second time, so batch handlers must be idempotent. This also applies when the close falls between the acknowledgement and the handler in at-most-once mode (no [RetryPolicy], the batch is acknowledged before the handler runs), and to a failed batch that was republished for a retry, whose originals the broker then delivers as well. Resuming does not wait for the batch handler, because the batch consumer only buffers deliveries (observed against RabbitMQ 3.13.7: consuming resumed at the channel close while the handler still held its batch). When the consumer connection is lost instead, the RabbitMQ client's automatic connection recovery restores the consumer on the same channel and the broker delivers the unacknowledged messages again, so the messages still buffered for the next batch are dropped the same way and logged as a warning; the handler sees each of them once, apart from the batch it already held. Partitioned streams use the RabbitMQ Stream protocol client and its own reconnection.
A stream without [StreamPartitions] uses a prefetch of MaxMessagesBeforeProcessing but hands its deliveries to the handler's batch one at a time, so a batch holds messages in stream offset order and its checkpoint does not pass an offset that lands in the next batch.
Stream start positions and checkpoints
When a MessageStreamCheckpoint<T> is registered and holds no position for a reader, StartPosition.Last() and StartPosition.Timestamp(...) are resolved to a concrete offset and stored before consumption starts. RabbitMQ has no AMQP call for that, so the client attaches a short-lived probe consumer (a dedicated channel on the consumer connection, no Stream protocol port needed; for a partitioned stream, one per partition stream) at the last chunk or at the timestamp and reads the x-stream-offset of what it is delivered. A first start therefore takes about 0.3 s longer when the stream holds messages and about 1 s longer when the stream (or partition) is empty. If the broker cannot answer, the position is stored after the first processed batch instead.
Partitioned stream recovery
When the start position of a partition of a partitioned stream cannot be resolved (for example the MessageStreamCheckpoint<T> store is unavailable while the partition is assigned), Flowly retries the resolution for up to 40 seconds, so a short outage drops nothing. If the partition is still unresolved, it is reported as Waiting (see the root README.md), the messages the broker's client still delivers for it are dropped and counted (flowly.message.stream.partition.dropped, with a log summary at most every 30 seconds instead of a warning per message), and the Stream consumer is recreated automatically with a growing delay (5 seconds doubling up to 2 minutes) until the partition resolves. The healthy partitions are re-initialized from their checkpoints by each recreation and the batch they were processing is delivered again, so handlers must be idempotent. After 3 consecutive recreations that still leave a partition waiting, the instance stands down: it keeps its consumer closed for a cool-down (1 minute, doubling to 5 minutes) so the broker can hand the partitions to another instance that may be able to resolve them, then creates it again; an instance that is alone still recovers after every cool-down but consumes nothing while it lasts. The stand-down is logged and counted in flowly.message.stream.partition.stand_downs. Nothing is skipped: after the partition starts, everything since the stored position is delivered.
Local Development
dotnet tool install --global Flowly.Tool
flowly docker-compose --project ./MyService --output docker-compose.yml
docker compose up -d
Documentation
Full guide including retry topology, events, and multi-provider configuration: https://rasmustherkelsen.github.io/flowly/
| 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
- Flowly (>= 1.5.1)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.0)
- RabbitMQ.Client (>= 7.2.2)
- RabbitMQ.Stream.Client (>= 1.12.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 |
|---|---|---|
| 1.6.0 | 53 | 12/1/2026 |
| 1.5.1 | 56 | 12/1/2026 |
| 1.5.0 | 102 | 11/20/2026 |
| 1.4.4 | 176 | 8/27/2026 |
| 1.4.3 | 151 | 8/13/2026 |
| 1.4.2 | 136 | 8/13/2026 |
| 1.4.1 | 135 | 8/11/2026 |
| 1.4.0 | 145 | 8/11/2026 |
| 1.3.2 | 153 | 7/3/2026 |
| 1.3.1 | 147 | 6/26/2026 |
| 1.3.0 | 145 | 6/24/2026 |
| 1.2.0 | 186 | 5/27/2026 |
| 1.1.1 | 142 | 5/22/2026 |
| 1.1.0 | 158 | 5/18/2026 |
| 1.0.1 | 137 | 5/6/2026 |
| 1.0.0 | 125 | 5/6/2026 |