Skip to content

Confirm durable RabbitMQ message transfers - #24

Merged
KilianBoute merged 2 commits into
mainfrom
fix/confirmed-rabbitmq-delivery
Sep 8, 2026
Merged

KilianBoute merged 2 commits into
mainfrom
fix/confirmed-rabbitmq-delivery

Conversation

@KilianBoute

Copy link
Copy Markdown
Member

Summary

  • publish RabbitMQ messages as persistent and wait for publisher confirms
  • return synchronous errors for negative acknowledgements, timeouts, closed channels, and mandatory unroutable returns
  • serialize publish, reconnect, and close operations so producer channels cannot be replaced while awaiting confirmation
  • acknowledge source deliveries only after confirmed destination, dead-letter, or configured disaster-recovery handling
  • requeue and reconnect when transfer or source acknowledgement settlement fails
  • add unit coverage for ACK/NACK settlement and opt-in live RabbitMQ coverage for unroutable publishes plus persistent redelivery after connection interruption

Why

Consumers previously could acknowledge a source delivery after an asynchronous mandatory return or after destination/dead-letter recovery failed. That could lose messages during queue drift or RabbitMQ interruption.

Validation

  • go test ./...
  • go test -race ./pkg/queue
  • go vet ./...
  • go mod verify
  • CGO_ENABLED=0 go test ./...
  • git diff --check

The live RabbitMQ integration cases compile but were skipped locally because no RABBITMQ_HOST, RABBITMQ_USERNAME, and RABBITMQ_PASSWORD or local broker runtime were available.

Use persistent publisher confirms and synchronous mandatory-return handling. Requeue source deliveries when forwarding, retry, dead-letter, recovery, or acknowledgement settlement fails, and add focused plus live-broker interruption coverage.
@codecov

codecov Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 14.77273% with 225 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/queue/rabbitmq.go 14.77% 223 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Preserve legacy publish and consumer behavior by default. Provision a separate confirm-mode producer only when enabled, and expose explicit confirmed publish and consumer methods for service-by-service rollout.
@KilianBoute

Copy link
Copy Markdown
Member Author

Rollout clarification after commit 9b39734: confirmed delivery is now explicitly opt-in, not a global behavior change. Existing Publish, PublishWithDelay, ReadMessages, ReadRawMessages, ReadOneRaw, RouteMessages, and AddToDeadletter retain legacy behavior and do not incur publisher-confirm latency merely by upgrading the dependency. A service opts in with SetConfirmedDelivery(true) and the matching *Confirmed method (PublishConfirmed, ReadMessagesConfirmed, etc.). Export is the intended first adopter in a small follow-up after this queue change is released; high-traffic media pipeline services can remain on legacy methods until benchmarked separately. Full tests, race tests, vet, module verification, and static tests pass; an unchanged Export build and a temporary confirmed Export integration both pass.

@KilianBoute
KilianBoute merged commit b9c17b0 into main Sep 8, 2026
5 checks passed
@KilianBoute
KilianBoute deleted the fix/confirmed-rabbitmq-delivery branch September 8, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant