Skip to content

Commit

Permalink
Add warning to Connection.Channel go-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerpet committed Jan 16, 2025
1 parent c2f3338 commit 5c1c00a
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 5c1c00a

Please sign in to comment.