Declare used to declare queues/exchanges/bindings. Declaration is saved and will be re-run every time Client gets connection
(d []Declaration)
| 42 | // Declare used to declare queues/exchanges/bindings. |
| 43 | // Declaration is saved and will be re-run every time Client gets connection |
| 44 | func (c *Client) Declare(d []Declaration) { |
| 45 | c.l.Lock() |
| 46 | defer c.l.Unlock() |
| 47 | c.declarations = append(c.declarations, d...) |
| 48 | if ch, err := c.channel(); err == nil { |
| 49 | for _, declare := range d { |
| 50 | declare(ch) |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | // Consume used to declare consumers |
| 56 | func (c *Client) Consume(cons *Consumer) { |