amqp
amqp copied to clipboard
same channel hadler in many go routiens
I am having single channel handler to publish message and this handler is passed to multiple go routine at same time. Are channel handlers thread safe?
Yes.
EDIT: But should you do it? Please see #327 and follow the links from that issue to read about thread safety, concurrent publish, concurrent read/publish, single point of IO to the broker etc.
It's also worth mentioning that even though this code is thread safe in a sense that it won't panic it might result in an issue on the server side. I've personally only used this package with a single go routine managing the publishing on the channel. See here for example.