Close shutdown the client
()
| 98 | |
| 99 | // Close shutdown the client |
| 100 | func (c *Client) Close() { |
| 101 | atomic.StoreInt32(&c.run, noRun) // c.run = false |
| 102 | conn, _ := c.conn.Load().(*amqp.Connection) |
| 103 | if conn != nil { |
| 104 | conn.Close() |
| 105 | } |
| 106 | c.conn.Store((*amqp.Connection)(nil)) |
| 107 | } |
| 108 | |
| 109 | // Loop should be run as condition for `for` with receiving from (*Client).Errors() |
| 110 | // |