-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
produce messages partitioned by value #115
Conversation
msg.Partition = &part | ||
}else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please run gofmt or your alternative on this? 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and would it make sense to group the guards slightly differently?
if msg.Partition == nil {
if msg.Value != nil && cmd.partitioner == "hashCodeByValue" {
part = hashCodePartition(*msg.Value, partitionCount)
msg.Partition = &part
} else if msg.Key != nil && cmd.partitioner == "hashCode" {
part = hashCodePartition(*msg.Key, partitionCount)
msg.Partition = &part
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will do it
$ echo 'no key specified message' | kt produce -topic greetings -partitioner hashCodeByValue | ||
Sent message to a partition decided by your case | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome! thanks for adding an example and doc in general!
hey @LucasDove ! sorry for the delay, and thanks very much for your time and contribution! i suggested two small changes (gofmt & regrouping of guards) - would you mind doing these or should I pull your changes in and perform the changes? |
FYI: if you rebase / merge current master, the CI should switch over to GH actions and work 👍 |
I want this feature because in my case, I just want every each partition of a topic could have messages without setting partition key for every message.