AddPartition appends a partition to the request. On v8+ it targets Groups[0] (seeded from ConsumerGroup if needed); use AddGroupPartition for v8 batches.
(topic string, partitionID int32)
| 342 | // AddPartition appends a partition to the request. On v8+ it targets Groups[0] |
| 343 | // (seeded from ConsumerGroup if needed); use AddGroupPartition for v8 batches. |
| 344 | func (r *OffsetFetchRequest) AddPartition(topic string, partitionID int32) { |
| 345 | if r.Version >= 8 { |
| 346 | if len(r.Groups) == 0 { |
| 347 | r.Groups = []OffsetFetchRequestGroup{{GroupId: r.ConsumerGroup}} |
| 348 | } |
| 349 | r.Groups[0].AddPartition(topic, partitionID) |
| 350 | return |
| 351 | } |
| 352 | if r.partitions == nil { |
| 353 | r.partitions = make(map[string][]int32) |
| 354 | } |
| 355 | |
| 356 | r.partitions[topic] = append(r.partitions[topic], partitionID) |
| 357 | } |
| 358 | |
| 359 | // AddGroupPartition adds a partition under group in a v8+ batch, creating the |
| 360 | // group entry if absent. |
no outgoing calls