Skip to content

ref(kafka): Make routing key optional, instead of randomizing it #4738

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

Merged
merged 1 commit into from
May 20, 2025

Conversation

Dav1dde
Copy link
Member

@Dav1dde Dav1dde commented May 14, 2025

Instead of randomly generating a routing key, we can just not set one in the first place.

If neither key nor partition is present a partition will be assigned in a round-robin fashion

From: https://stackoverflow.com/a/62211664

#skip-changelog

@Dav1dde Dav1dde requested a review from a team as a code owner May 14, 2025 13:18
@Dav1dde Dav1dde self-assigned this May 14, 2025
@Dav1dde Dav1dde force-pushed the dav1d/optional-key-kafka branch from 0dcf936 to 7fea375 Compare May 15, 2025 07:27
Comment on lines 78 to +79
/// Returns the partitioning key for this kafka message determining.
fn key(&self) -> [u8; 16];
fn key(&self) -> Option<[u8; 16]>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to the change, but I don't understand what this docstring is trying to say.

@Dav1dde Dav1dde merged commit ab28ea7 into master May 20, 2025
28 checks passed
@Dav1dde Dav1dde deleted the dav1d/optional-key-kafka branch May 20, 2025 11:11
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.

2 participants