Skip to content

feat: Updating producer to configure RoutingPolicy - adding partition_key as the default for Round Robin if set#366

Merged
BewareMyPower merged 13 commits intostreamnative:masterfrom
kaustubh-garimella-genius:kg/routing_policy
Oct 24, 2025
Merged

feat: Updating producer to configure RoutingPolicy - adding partition_key as the default for Round Robin if set#366
BewareMyPower merged 13 commits intostreamnative:masterfrom
kaustubh-garimella-genius:kg/routing_policy

Conversation

@kaustubh-garimella-genius
Copy link
Contributor

@kaustubh-garimella-genius kaustubh-garimella-genius commented Oct 6, 2025

Should address: #322

https://pulsar.apache.org/docs/next/client-libraries-producers/#choose-partitions-when-using-a-key

Copying the behavior in the Java Client, where the producer takes in a configuration for a RoutingPolicy (RoundRobin, Single or Custom) for publishing to a partitioned topic.

Non breaking behavior since if you don't specify a routing policy, it will automtically be Round Robin. Similarly to the Java Client, if you explicitly have a partition_key set in your message, it will deterministically hash the key and route to a partition that way

@kaustubh-garimella-genius
Copy link
Contributor Author

@BewareMyPower when you get a chance, please take another look. Updated with some additional tests and slightly changed the behavior to work with a stable vec of producers.

@kaustubh-garimella-genius
Copy link
Contributor Author

Fixed the round robin unit test

@BewareMyPower
Copy link
Contributor

Please fix lint error

@BewareMyPower BewareMyPower merged commit 69be588 into streamnative:master Oct 24, 2025
7 checks 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.

2 participants