grabBrokerConn returns a connection to a specific broker represented by the broker id passed as argument. If the broker id was not known, an error is returned.
(ctx context.Context, brokerID int32)
| 642 | // broker id passed as argument. If the broker id was not known, an error is |
| 643 | // returned. |
| 644 | func (p *connPool) grabBrokerConn(ctx context.Context, brokerID int32) (*conn, error) { |
| 645 | p.mutex.RLock() |
| 646 | g := p.conns[brokerID] |
| 647 | p.mutex.RUnlock() |
| 648 | if g == nil { |
| 649 | return nil, BrokerNotAvailable |
| 650 | } |
| 651 | return g.grabConnOrConnect(ctx) |
| 652 | } |
| 653 | |
| 654 | // grabClusterConn returns the connection to the kafka cluster that the pool is |
| 655 | // configured to connect to. |
no test coverage detected