- high performance, language agnostic, TCP protocol • Run as a cluster of 1 or more servers (brokers) • Uses ZooKeeper for broker coordination • Maintains feeds of messages (topics) • Consumer - process subscribed to a topic • Producer - process publishing messages
Before publishing, queries the leader broker for each partition • Responsible for assigning partition to each message • Can use round robin or custom semantics • Partitioner is informed about number of partitions
implementation of partitioner public class SimplePartitioner implements Partitioner<String> { public SimplePartitioner (VerifiableProperties props) { } public int partition(String key, int numberOfPartitions) { return Math.abs(key.hashCode()) % numberOfPartitions; } }
group abstraction - generalize both models. • Strong ordering guarantee • Each partition consumed by one consumer in group • Keep track of progress (store in zookeeper)
• High Level - easier and straightforward (no offset management) • Simple Consumer - not so simple ◦ read a message multiple times ◦ consume a subset of partitions in a process ◦ manage transactions to ensure message processed only once ◦ Require following several steps: ▪ find active broker & leader for a topic and a partition ▪ determine replica ▪ build request & fetch data ▪ recover from leader changes.
Level Consumer • No security on messaging layer (not supported by kafka) • Producer can sending duplicate messages (identified by transactionId). • Consumer, responsible for not processing duplicate messaging by managing message transactionId (store a limited set in a document). • Number of partitions - 12. • 3 Zookeeper servers & 3 Kafka servers • Messages persisted 1-2 days • Partitioning to be decided later • Monitoring needs to be addressed