lapin
lapin copied to clipboard
Sharing `Channel` over async green threads
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?