lapin icon indicating copy to clipboard operation
lapin copied to clipboard

Sharing `Channel` over async green threads

Open raui100 opened this issue 6 months ago • 1 comments

I have built a web-app using axum&tokio that creates a new green thread per request. I'm using lapin for RPC with RabbitMQ over a single channel which seems to work.
I've stumbled across the RabbitMQ documentation which discourages sharing Channels. Does this apply to lapin::Channel too and does this apply in an async context?

Is it recomment to share the connection and create a new lapin::Channel per incoming request?

Also it says in the documentation that closing a connection closes the underlying channels. Dropping a lapin::Connection doesn't close the underlying Connection which surprised me. Is it necessary to implement clean up code that closes all lapin::Connection and lapin::Channels at the end?

raui100 avatar Aug 12 '24 12:08 raui100