Skip to content

Commit

Permalink
Merge pull request #294 from rabbitmq/fix/issue-291
Browse files Browse the repository at this point in the history
Add warning about concurrency with Channels
  • Loading branch information
lukebakken authored Jan 16, 2025
2 parents c2f3338 + 5c1c00a commit cc82041
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,10 @@ func (c *Connection) closeChannel(ch *Channel, e *Error) {
Channel opens a unique, concurrent server channel to process the bulk of AMQP
messages. Any error from methods on this receiver will render the receiver
invalid and a new Channel should be opened.
Channels are not thread-safe. To avoid unexpected behavior, do not share
a single Channel instance between multiple goroutines. Concurrent calls
to Channel methods may result in race conditions or unpredictable outcomes.
*/
func (c *Connection) Channel() (*Channel, error) {
return c.openChannel()
Expand Down

0 comments on commit cc82041

Please sign in to comment.