0

I have come across one scenario where I want to maintain single kafka topic(message-processing-topic) with 'N' Partitions. Say for example 200 partitions.

I want to use the same topic for all the customers. Say I have 20 customers. I want to use 10 partitions for each customer.

Each customer have their Id which will be Kafka Message Key while producing the message. I wanted to land the same set of message (Key) to go in to specific set of partitions.

I wanted to use SetPartitioner from ProducerBuilder class to put a logic to compute the n (10) number of partitions. But i do not want to hard code it. Like some kind of hash or algorithm i wanted to use here.

How to achieve this and what is the pros and cons are there.

I knew that i can not do scaling in this approach. Is there any other solutions is there for the same scenario.

Thoughts are welcome and appreciated.

0 Answers0