RoundRobin is an Balancer implementation that equally distributes messages across all available partitions. It can take an optional chunk size to send ChunkSize messages to the same partition before moving to the next partition. This can be used to improve batch sizes.
| 39 | // ChunkSize messages to the same partition before moving to the next partition. |
| 40 | // This can be used to improve batch sizes. |
| 41 | type RoundRobin struct { |
| 42 | ChunkSize int |
| 43 | // Use a 32 bits integer so RoundRobin values don't need to be aligned to |
| 44 | // apply increments. |
| 45 | counter uint32 |
| 46 | |
| 47 | mutex sync.Mutex |
| 48 | } |
| 49 | |
| 50 | // Balance satisfies the Balancer interface. |
| 51 | func (rr *RoundRobin) Balance(msg Message, partitions ...int) int { |
nothing calls this directly
no outgoing calls
no test coverage detected