You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The way I understand it there are 2 ways to produce messages in kafka-go. You either use Conn to produce messages to a particular partition of a particular topic, or you use Writer to produce messages to a particular topic letting balancer to choose which partition to send message to.
So I guess if one wants to explicitly specify partition to send message to while using only one underlying connection, he should use custom balancer which always returns the same partition? Something like
typeCustomBalancerstruct {
// lock may be required depending on the usage, I guess...Partitionint
}
func (cb*CustomBalancer) Balance(_Message, _...int) int {
returncb.Partition
}
func (cb*CustomBalancer) SetPartition(partitionint) {
cb.Partition=partition
}
The text was updated successfully, but these errors were encountered:
The way I understand it there are 2 ways to produce messages in kafka-go. You either use Conn to produce messages to a particular partition of a particular topic, or you use Writer to produce messages to a particular topic letting balancer to choose which partition to send message to.
So I guess if one wants to explicitly specify partition to send message to while using only one underlying connection, he should use custom balancer which always returns the same partition? Something like
The text was updated successfully, but these errors were encountered: