Update RabbitMQ.Client to version 7.0.0#8797
Conversation
Refactor topic implementations to always use IAsyncDisposable
|
Thank you for the contribution @ittennull :) Some tests are still failing. It would be great if you could get them to pass. |
|
I fixed one test but all the RabbitMQ tests are red because the test library Squadron.RabbitMQ also uses outdated RMQ client which is not compatible with the new version. They don't have an update for it yet. |
There was a problem hiding this comment.
Pull Request Overview
This PR updates the RabbitMQ.Client package from version 6.4.0 to 7.1.2 and refactors the topic implementations to consistently use IAsyncDisposable instead of IDisposable for better asynchronous resource management.
- Updates RabbitMQ.Client to version 7.1.2 for compatibility with projects using newer versions
- Refactors all topic implementations to use IAsyncDisposable pattern throughout the codebase
- Migrates RabbitMQ test infrastructure from Squadron to Testcontainers
Reviewed Changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Directory.Packages.props | Updates RabbitMQ.Client to 7.1.2 and adds Testcontainers packages |
| DefaultTopic.cs | Changes session handling to use IAsyncDisposable instead of IDisposable |
| DefaultPubSub.cs | Adds IsDisposed property for disposal state tracking |
| RabbitMQTopic.cs | Major refactor to use async RabbitMQ.Client 7.x APIs and IAsyncDisposable |
| RabbitMQConnection.cs | Complete rewrite to use async connection APIs and proper resource management |
| PostgresTopic.cs | Updates to return IAsyncDisposable from OnConnectAsync |
| NatsTopic.cs | Updates Session class to implement IAsyncDisposable |
| RedisTopic.cs | Removes synchronous Dispose method, keeping only async disposal |
| Test files | Updates test infrastructure and fixes disposal patterns |
Files not reviewed (1)
- src/HotChocolate/Core/src/Subscriptions.RabbitMQ/Properties/RabbitMQResources.Designer.cs: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Thanks for fixing up the tests! |
TestContainers work better here because the package only starts and stops containers and it doesn't depend on RabbitMq.Client library at all, so it's safer for any future updates |
@tobias-tengler Hi, did you have a chance to confer with the team yet? |
|
@ittennull Yes, we're going to stick with Squadron for now. Also, please downgrade RabbitMQ.Client to just 7.0.0. We do not want to force people to use a specific minor/patch version. |
This reverts commit 9cf9db9.
|
OK, will do. The update of Squadron failed though |
|
I saw that you updated Squadron to support RMQ 7 but the build fails because of the build scripts. I created a PR to fix it but nobody reviews it. I even wrote an email to the person who created these build scripts - no response. |
|
@ittennull Good catch with the .slnx. I'll just undo my change to the solution file in the Squadron repository. Let's hope this fixes the issue. |
|
@ittennull Squadron v26.0.0 is now available :) |
|
@tobias-tengler I updated the package. Could you approve the workflow and check the PR again? |
tobias-tengler
left a comment
There was a problem hiding this comment.
@ittennull Looks good! :) I just have couple of questions.
- pass rabbitMqSubscriptionOptions to AddRabbitMQSubscriptionPublisher - add ability to use server-generated RMQ queue names - make queue auto-deletable
|
I also marked the queue as auto-delete because I noticed that we have thousands of messages and queues lying around with zero consumers. That happens when a graphql subscription finishes and a consumer unsubscribes. A queue is exclusive and isn't deleted because the connection that created it still lives and serves other new queues. So the only way to clean RMQ memory and storage is to restart your app |
tobias-tengler
left a comment
There was a problem hiding this comment.
@ittennull Thanks for addressing my questions and thanks again for your time / contribution :)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8797 +/- ##
============================
============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary of the changes (Less than 80 chars)
Closes #8381
Old version of RabbitMQ.Client creates runtime errors if a projects uses 7.* version of RabbitMQ.Client or any dependency that rely on it, for example Masstransit