Using the same channel for publishing and consuming from the same queue in C# client #1894
Replies: 2 comments
-
|
Two comments:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Neither the client nor RabbitMQ won't complain. But because error handling is per channel, it does not make much sense to try to reuse channels like that. In fact, due to resource alarms potentially blocking publishers, the best practice is to use one connection for publishing and one for consumption, to the extent you can. That immediately settles this debate: a channel cannot belong to two connections. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am using the RabbitMQ .NET client and wanted to clarify the behavior and best practices around channel usage.
Is it supported to use the same channel (IModel) for both publishing and consuming messages from the same queue?
Specifically:
• Will RabbitMQ handle this correctly at the protocol level?
• Are there known issues with the .NET client regarding thread safety or channel closure when publishing and consuming concurrently on the same channel?
I understand that channels are not thread-safe and that best practice is to use separate channels, but I would like to know whether this is technically supported and what the exact risks or limitations are.
Thank you for your guidance.
Beta Was this translation helpful? Give feedback.
All reactions