0% found this document useful (0 votes)
3 views3 pages

Kafka-Setup-Notes

Apache Kafka is a distributed streaming platform designed for processing real-time data feeds with high throughput and low latency, utilizing a Publisher and Subscriber model. The document outlines the steps to set up a Spring Boot application with Apache Kafka, including downloading Zookeeper and Kafka, starting servers, creating topics, and adding necessary dependencies. It also provides sample data for testing the application.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Kafka-Setup-Notes

Apache Kafka is a distributed streaming platform designed for processing real-time data feeds with high throughput and low latency, utilizing a Publisher and Subscriber model. The document outlines the steps to set up a Spring Boot application with Apache Kafka, including downloading Zookeeper and Kafka, starting servers, creating topics, and adding necessary dependencies. It also provides sample data for testing the application.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

==============

Apache Kafka
==============

=> Apache Kafka is a distributed streaming platform

=> Apache Kafka is used to process real time data feeds with high throughput and
low latency

Ex : flights data, sensors data, stocks data, news data, social media etc....

=> Kafka works based on Publisher and Subscriber model

===================
Kafka Terminology
===================
Zookeeper
Kafka Server
Kafka Topic
Message
Publisher
Subscriber

===========
Kafka APIs
===========
Connector API
Publisher API
Subscriber API
Streams API

========================================
Spring Boot + Apache Kafka Application
=======================================

Step-1 : Download Zookeeper from below URL

URL : http://mirrors.estointernet.in/apache/zookeeper/stable/

Step-2 : Download Apache Kafka from below URL

URL : http://mirrors.estointernet.in/apache/kafka/

Step-3 : Set Path to ZOOKEEPER in Environment variables upto bin folder

Step-4 : Start Zookeeper server using below command from Kafka folder

Command : zookeeper-server-start.bat zookeeper.properties

Note: Above command will available in kafka/bin/windows folder

Note: zookeeper.properties file will be available in kafka/config folder. You can


copy zookeeper.properties and server.properties files from kafka/config folder to
kafka/bin/windows folder.

Step-5: Start Kafka Server using below command from Kakfa folder

Command : kafka-server-start.bat server.properties


Note: server.properties file will be available in config folder (Copied to windows
folder)

Step-6 : Create Kakfa Topic using below command from kafka/bin/windows folder

Command : kafka-topics.bat --create --bootstap-server localhost:9092 --replication-


factor 1 --partitions 1 --topic demo-jrtp22-topic

Step-7 : View created Topics using below command

Command : kafka-topics.bat --list --bootstap-server localhost:9092

============================================
Step-8 : Create Spring Boot Project in IDE
============================================

Step-9: Add below kafka related dependencies in pom.xml

<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

Step-9: Create RestController, KafaProducer and KafaConsumer classes to publish and


subsribe message

Step-10: Test application using PostMan.

Sample Data
------------

{
"customerId":101,
"customerName":"Ashok",
"customerEmail":"[email protected]"
}
---------------------------------
[

{
"customerId":101,
"customerName":"Ashok",
"customerEmail":"[email protected]"
},

{
"customerId":102,
"customerName":"Raj",
"customerEmail":"[email protected]"
},
{
"customerId":102,
"customerName":"John",
"customerEmail":"[email protected]"
}

You might also like