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

Method DialPartition

dialer.go:143–152  ·  view source on GitHub ↗

DialPartition opens a connection to the leader of the partition specified by partition descriptor. It's strongly advised to use descriptor of the partition that comes out of functions LookupPartition or LookupPartitions.

(ctx context.Context, network string, address string, partition Partition)

Source from the content-addressed store, hash-verified

141// descriptor. It's strongly advised to use descriptor of the partition that comes out of
142// functions LookupPartition or LookupPartitions.
143func (d *Dialer) DialPartition(ctx context.Context, network string, address string, partition Partition) (*Conn, error) {
144 return d.connect(ctx, network, net.JoinHostPort(partition.Leader.Host, strconv.Itoa(partition.Leader.Port)), ConnConfig{
145 ClientID: d.ClientID,
146 Topic: partition.Topic,
147 Partition: partition.ID,
148 Broker: partition.Leader.ID,
149 Rack: partition.Leader.Rack,
150 TransactionalID: d.TransactionalID,
151 })
152}
153
154// LookupLeader searches for the kafka broker that is the leader of the
155// partition for a given topic, returning a Broker value representing it.

Callers 2

DialLeaderMethod · 0.95
DialPartitionFunction · 0.80

Calls 1

connectMethod · 0.95

Tested by

no test coverage detected