MCPcopy
hub / github.com/segmentio/kafka-go / grabClusterConn

Method grabClusterConn

transport.go:667–669  ·  view source on GitHub ↗

grabClusterConn returns the connection to the kafka cluster that the pool is configured to connect to. The transport uses a shared `control` connection to the cluster for any requests that aren't supposed to be sent to specific brokers (e.g. Fetch or Produce requests). Requests intended to be route

(ctx context.Context)

Source from the content-addressed store, hash-verified

665// In either cases, the requests are multiplexed so we can keep a minimal number
666// of connections open (N+1, where N is the number of brokers in the cluster).
667func (p *connPool) grabClusterConn(ctx context.Context) (*conn, error) {
668 return p.ctrl.grabConnOrConnect(ctx)
669}
670
671func (p *connPool) sendRequest(ctx context.Context, req Request, state connPoolState) promise {
672 brokerID := int32(-1)

Callers 2

discoverMethod · 0.95
sendRequestMethod · 0.95

Calls 1

grabConnOrConnectMethod · 0.80

Tested by

no test coverage detected