NewClient initializes new Client
(opts ...ClientOpt)
| 230 | |
| 231 | // NewClient initializes new Client |
| 232 | func NewClient(opts ...ClientOpt) *Client { |
| 233 | c := &Client{ |
| 234 | run: run, |
| 235 | declarations: make([]Declaration, 0), |
| 236 | consumers: make(map[*Consumer]struct{}), |
| 237 | publishers: make(map[*Publisher]struct{}), |
| 238 | errs: make(chan error, 100), |
| 239 | blocking: make(chan amqp.Blocking, 10), |
| 240 | } |
| 241 | |
| 242 | for _, o := range opts { |
| 243 | o(c) |
| 244 | } |
| 245 | return c |
| 246 | } |
| 247 | |
| 248 | // URL is a functional option, used in `NewClient` constructor |
| 249 | // default URL is amqp://guest:guest@localhost/ |
no outgoing calls