Introduction To Apache Kafka
Introduction To Apache Kafka
KAFKA
Presented By:
Vaisakh Mohanan
Overview
Kafka Cluster
Message Brokers
Broker
Publisher Subscriber
Message Producer Message Consumer
Kafka Architecture as a Messaging System
Kafka Cluster Consumer Group 1
Broker 1
Pull Message Consumer A
Push Message Broker 2
Producer A Broker 3 Consumer B
P1
Topic X
Producer B
P2
Consumer C
Producer C P3
Topic Y Consumer D
P4
Consumer Group 2
Get Kafka Broker Id Update Offset
Kafka Zookeeper
Kafka Components
1. Topic
A unique name for Kafka Stream
A category or feed name to which records or messages are published, and stored
Always multi-subscriber
Has partitions - an ordered, immutable sequence of records that is continually
appended to a structured commit log – identified by Offset
2. Kafka Producer
Publishes messages to a Kafka topic
Responsible for choosing which record to assign to which partition within the topic
Kafka Components
3. Kafka Consumer
This component subscribes to topics
Reads and processes messages from the topics - pull messages
4. Kafka Broker
Manages the storage of messages in the topics
More than one broker – Kafka Cluster
5. Zookeeper
Offers the brokers with metadata about the processes running in the system
Facilitate health checking, managing and coordination
Kafka Core Api’s
Messaging
Replacement to traditional message broker
Kafka has better throughput, built-in partitioning, replication, and fault-tolerance
Good solution for large-scale message processing applications.
Metrics
For operational monitoring data
Includes aggregating statistics from distributed applications to produce centralized feeds
of operational data.
Event Sourcing
Excellent backend for applications of event sourcing - supports very large stored log data
Kafka X Rabbit MQ
Usage Fits for high flux event Fits well as a traditional message
Scenarios streaming use-cases broker.
• With loosely coupled message
environment
Message Works on Pull Model where
Forwarding Works with the Push model having
Consumers act smart while
Model Dumb Consumers and Smart broker
Kafka broker acts dumb
Data Flow Distinct bounded data packets Unbounded continuous data in the
in the form of messages form of key-value pairs.
Download Apache Kafka from the following link – (Scala 2.13 - kafka_2.13-3.3.1.tgz (asc, sha512))
https://kafka.apache.org/downloads
• Open another command prompt and create a topic – The topic has one partition and one
replica by default
.\bin\windows\kafka-topics.bat --create --bootstrap-server localhost:9092 replication-factor 1 --
partitions 1 --topic mySampleKafkaDemo
• Next Open a new command prompt and create a producer to send message to the above
created topic and send a message to it
.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 –topic mySampleKafkaDemo
• Finally Open a new command prompt and start the consumer which listens to the topic we
just created above. We will get the message we had sent using the producer
.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic
mySampleKafkaDemo --from-beginning
Conclusion
https://www.tutorialspoint.com/apache_kafka/apache_kafka_introduction.htm
https://kafka.apache.org/intro
https://www.slideshare.net/AimdekTechnologies/introduction-to-apache-kafka-239053578
https://www.youtube.com/watch?v=eab-nQXGoD0
https://tutorialspedia.com/kafka-vs-rabbitmq-a-comparison-of-kafka-and-rabbitmq/
https://insidebigdata.com/2016/04/28/a-brief-history-of-kafka-linkedins-messaging-platform/
https://tutorialspedia.com/kafka-introduction-kafka-architecture-overview-use-cases-and-basic-conce
pts-explanation/
Thank You ...