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)
| 130 | // The original address is only used as a mechanism to discover the |
| 131 | // configuration of the kafka cluster that we're connecting to. |
| 132 | func (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 |