可以对所有goroutine使用一个RabbitMQ通道吗? [关闭]

I'm doing a message publisher and a receiver to/from rabbitmq queue. I'm planning to use one rabbitmq channel for publishing messages and one for fetching, but i also want my code to be asynchronous, is it the right way to use one rabbitmq channel per multiple goroutines?

I'm not a golang-guy, by I use every day RabbitMq with .Net driver; .Net driver channels (an abstraction that encapsulate interactions with queue/exchange and message publishing/subscribing) are very similar to golang RabbitMq channels, so I think my answer can help you. While connections are tread safe by design and are supposed to be shared between threads, channels are not: so, if different aysnchronous goroutines can be run in different threads (this is up to you: I don't known how golang runtime works) you should not share the same channel instance between them. I hope this can help you.

I have got error UNEXPECTED_FRAME when I used only one channel per multiple goroutines. This article https://www.cloudamqp.com/blog/2018-01-19-part4-rabbitmq-13-common-errors.html has good tips, see 3 item for this case.