Kafka is a distributed publisher-subscriber system which can be used for event streaming( pub-sub model) , message queues and batch processing. Kafka uses kafka-brokers to run and store data.
Thu, Dec 25, 2025
3 min read

Kafka is a distributed publish-subscribe messaging system which can be used for event streaming( pub-sub model) , message queues and batch processing. Kafka uses kafka-brokers to run and store data. The kafka architecture includes a kafka cluster which consist of different brokers that include topics which are like a categorized box where the producers send events or data and consumers subscribe to the topic and get the same events or data in same order sent by the producers.
The topics are further divided into sub-boxes known as partitions which helps in parallel processing. Different brokers include many partitions of the topics for parallel processing so that if one partition is used to write data , the another follower broker can help the consumer read the data from the topic. The brokers follow master-slave( leader-follower) architecture which is managed by the kafka-zookeeper responsible for resource allocation , fault tolerence , parallel processing , etc.



As systems grow in scale and complexity. They have to be divided into different decoupled microservices for breaking down the complexity and handling the scalability. Now, communication between these services becomes quite difficult, where kafka comes into picture for real-time , low latency and high throughput event streaming with data incorporating a pub-sub model.
version: '3.9'
services:
kafka:
image: bitnami/kafka:3.7
environment:
- KAFKA_ENABLE_KRAFT=yes
- KAFKA_CFG_NODE_ID=1
- KAFKA_CFG_PROCESS_ROLES=controller,broker
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@kafka:9093
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
- KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=true
ports:
- "9092:9092"
volumes:
- kafkadata:/bitnami/kafka
volumes:
kafkadata: