Skip to content
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

Merged
merged 4 commits into from
Sep 9, 2023
Merged

Conversation

LucasDove
Copy link

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.

msg.Partition = &part
}else {
Copy link
Owner

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? 🙏

Copy link
Owner

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
	}
}

Copy link
Author

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


Copy link
Owner

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!

@fgeller
Copy link
Owner

fgeller commented Dec 4, 2020

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?

@fgeller
Copy link
Owner

fgeller commented Dec 5, 2020

FYI: if you rebase / merge current master, the CI should switch over to GH actions and work 👍

@fgeller fgeller merged commit b09d29e into fgeller:main Sep 9, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants