Hello All I have a single producer service which is queuing message into a topic with let say 12 partitions. I want to evenly distribute the messages across all the partitions in a round robin fashion. Even after using default partitioning and keeping key 'NULL', the messages are not getting distributed evenly. Rather some partitions are getting none of the messages while some are getting multiple. One reason I found for this behaviour, somewhere, is that if there are lesser number of producers than the number of partitions, it distributes the messages to fewer partitions to limit many open sockets. However I have achieved even distribution through code by first getting total partition numbers and then passing partition number in the incremental order along with the message into the producer record. Once the partition number reaches end of the partition number then again resetting the next partition number to zero.
Query: 1. Is there can be any downside of above approach used? 2. If yes, how to achieve even distribution of messages in an optimized way?