0
votes

I am implementing kafka producer with single topic with multiple partitions. I am choosing to which partition a message goes by a particular value (feedName property value in message json ) in message. I am maintaining an SQL table for the feedName - partitionId mapping. My questions is Will the partition Id will be same for leader as well as replicas ? If different how can I identify a partition uniquely across all brokers?

2

2 Answers

1
votes

Partition ID is same across the brokers. If not, would get real confusing.

Partition IDs are maintained in Zookeeper, and all brokers have access to Zookeeper. This is what it's used for -- so all the brokers have the same view of Topics and Partions (and brokers, for that matter).

-1
votes

Partition id is immutable message sequence. You can find the same in Kafka documentation

Each partition is an ordered, immutable sequence of messages that is continually appended to—a commit log.

In your use case you no need to worry about mapping of id and feedName.

Hope this helps!