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

Method DialLeader

dialer.go:132–138  ·  view source on GitHub ↗

DialLeader opens a connection to the leader of the partition for a given topic. The address given to the DialContext method may not be the one that the connection will end up being established to, because the dialer will lookup the partition leader for the topic and return a connection to that serv

(ctx context.Context, network string, address string, topic string, partition int)

Source from the content-addressed store, hash-verified

130// The original address is only used as a mechanism to discover the
131// configuration of the kafka cluster that we're connecting to.
132func (d *Dialer) DialLeader(ctx context.Context, network string, address string, topic string, partition int) (*Conn, error) {
133 p, err := d.LookupPartition(ctx, network, address, topic, partition)
134 if err != nil {
135 return nil, err
136 }
137 return d.DialPartition(ctx, network, address, p)
138}
139
140// DialPartition opens a connection to the leader of the partition specified by partition
141// descriptor. It's strongly advised to use descriptor of the partition that comes out of

Callers 7

TestConnFunction · 0.95
testConnectFunction · 0.95
DialLeaderFunction · 0.80
produceRecordsFunction · 0.80
ReadLagMethod · 0.80
SetOffsetAtMethod · 0.80
initializeMethod · 0.80

Calls 2

LookupPartitionMethod · 0.95
DialPartitionMethod · 0.95

Tested by 3

TestConnFunction · 0.76
testConnectFunction · 0.76
produceRecordsFunction · 0.64