
Discover how to use Apache Kafka in a Spring Boot app with practical guidance on producers, consumers, topics, brokers, and Zookeeper, plus common use cases like messaging and stream processing.
Install and set up Apache Kafka locally by downloading, extracting, and renaming the folder, then start ZooKeeper and the Kafka broker on localhost 9092.
Create and set up a Spring Boot project in IntelliJ using Spring Initializr, add Spring Web and Spring for Apache Kafka dependencies, import, and run on port 8080.
Configure kafka producer and consumer in a Spring Boot application using auto-configuration and external properties. Set up application.properties with bootstrap-servers, group-id, auto-offset-reset earliest, and key/value serializers to enable seamless messaging.
Learn to build a Kafka producer with Spring Boot by injecting a KafkaTemplate and sending a message to the javaguides topic, with logging.
Configure Kafka producer and consumer to use json serializer and deserializer by updating application.properties, switching value deserializers and serializers to json from Spring Kafka, and enabling trusted packages for json.
Create a Spring Kafka producer to send a JSON message using KafkaTemplate, log the user payload, and publish to the javaguides topic.
create a Kafka consumer to consume json messages with Spring Kafka, using the Kafka listener on the javaguides_json topic with group-id myGroup, logging user objects in a Spring Boot app.
Implement a Wikimedia producer by wiring a Spring service, using a Kafka template, and streaming real-time Wikimedia changes via an event source to a Kafka topic.
Run a Spring Boot application that triggers a Wikimedia producer to emit messages to a Kafka topic, setting up ZooKeeper and broker for a real-time streaming demo.
Create a Spring Boot Kafka consumer module in the parent project and add a main class to run it, ready to consume data from the capture broker.
Configure a spring boot kafka consumer in application.properties to connect to the broker, set a consumer group, and specify key and value deserializers for real-time topic data.
Configure a Kafka consumer in a Spring Boot application, subscribing to the capture topic with a group id, and log each message received to verify real-time data flow.
Learn to save Wikimedia data to a MySQL database with Spring Boot and Apache Kafka, using a JPA entity and repository to store real-time events.
Externalize hard coded topic names via application properties and @Value, replacing code literals in Wikimedia and consumer projects to enable consistent configuration.
Explore how event-driven architecture uses decoupled microservices that publish and subscribe to events via a message broker, enabling asynchronous communication and loose coupling among order, stock, and email services.
Learn event-driven microservices with Spring Boot and Apache Kafka, using a single topic for multiple consumers. Build order, stock, and email services that publish and consume OrderEvent asynchronously.
Create four independent Spring Boot microservices OrderService, StockService, EmailService, and BaseDomains using Spring Initializr and Maven with Web and Kafka dependencies, then import into IntelliJ.
Import four Spring Boot projects into a single IntelliJ workspace and create a parent project with four modules. Run the three microservices on ports 8080, 8081, and 8082.
Configure the order service as a Kafka producer to publish events. Configure bootstrap servers, key/value serializers, and the topic name order_topics, and run Zookeeper and Kafka locally.
Configure a Kafka topic in a Spring Boot order service by retrieving the topic name from application.properties and exposing a topic bean with TopicBuilder.
Create a Spring order producer that sends OrderEvent messages to a Kafka topic using KafkaTemplate, with a topic header and SLF4J logging.
Create a rest api to place orders, assign a uuid, build an OrderEvent with pending status, and send it via OrderProducer to a Kafka topic through the /api/v1/orders endpoint.
Configure a Kafka consumer in the stock service with Spring Boot properties, including bootstrap servers, group-id, and auto-offset-reset. Consume messages from the order_topics topic using json deserializers and Spring Kafka.
Showcases an end-to-end event-driven microservices demo in which the order service publishes to the order_topics Kafka topic and stock and email services consume the events.
You can download the source code of this section as a zip file (attached to this lecture).
Or you can download the source code of this course from my GitHub repository - https://github.com/RameshMF/springboot-kafka-course
Kafka producers create messages, send them to a topic, choose a partition by manual selection, key-based routing, or round robin, and await 0, 1, or all acknowledgments.
Learn how a consumer group coordinates multiple consumers to read messages from a Kafka topic, with partitions assigned so each partition is processed by one consumer, and groups read independently.
Explore how producers send data to a Kafka cluster, where topics split into partitions and replicas on brokers enable fault tolerance, while consumers in groups read in parallel high throughput.
Discover how Kafka achieves high throughput and low latency by using sequential disk writes, zero-copy, partitions, and batching, plus memory caching and horizontal scaling.
Explore how Kafka ensures message durability through disk writes, multi-broker replication with in-sync replicas, strong acknowledgments, immutable logs, kraft metadata durability, and flexible retention policies.
Discover how Kafka achieves fault tolerance through cross-broker replication, leader-follower switching, in-sync replicas, safe write acknowledgments, automatic rebalancing, and KRIFT metadata replication.
Explore Kafka topics, partitions, brokers, replication, and Zookeeper role for fault-tolerance; and learn producers, consumers, offsets, consumer groups, exactly-once semantics, transactions, streams, retention, and log compaction.
Sample of the reviews:
"Awesome. I enjoyed every bit of the lecture. Ramesh is a great tutor and I always purchase his courses."
"A much-needed course today, Kafka is a required topic for Java devs who want to work with microservices. The instructor is excellent, he knows Kafka perfectly."
"This course has really helped me understand Kafka. I like the style of teaching. The hands-on experience has given me much-needed confidence. I would be recommended this course to my friends and colleagues."
"Great opportunity to learn this new concept and thanks a lot for this course, Happy to learn and gain this awesome knowledge."
"great course as ever by Mr.RameshFadatare. Have been great at tutorials in Youtube from years. The same legacy continuing on Udemy. need more content & detailed Kafka course keep updating this @RameshFadatare"
In this course, you will learn how to build Kafka Producer and Consumer to exchange different formats of data - String, JSON, and real-time Wikimedia stream data using Spring boot and Apache Kafka.
If you want to use Apache Kafka in Spring boot event-driven microservices then this course is useful to you.
What is the Spring Boot?
Spring Boot is an extension of the Spring framework that eliminated the boilerplate configurations required for setting up a Spring application.
Spring Boot is an opinionated framework that helps developers build Spring-based applications quickly and easily. The main goal of Spring Boot is to quickly create Spring-based applications without requiring developers to write the same boilerplate configuration again and again.
What is Apache Kafka?
Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.
What will you learn?
Learn Apache Kafka Core Concepts
Learn how to integrate Apache Kafka in the Spring boot application
Learn how to create Kafka Topic, Producer, and Consumer
Learn how to exchange string messages between Producer and Consumer using Kafka broker
Learn how to exchange JSON messages between Producer and Consumer using Kafka broker
Learn real-world use case (Wikimedia real-time stream data) implementation using Apache Kafka
Learn how to create real-world projects using Spring boot and Apache Kafka
Learn what is Event-Driven Architecture, how it works, and its advantages
Learn building Event-Driven Microservices using Spring Boot and Kafka
Tools and Technologies used in this course:
Technologies:
Java 8+
Spring Boot
Spring MVC
Spring Data JPA ( Hibernate)
Tomcat
Messaging Broker:
Apache Kafka
IDE:
Intellij IDEA
Database:
MySQL database
Tools:
Postman - Test REST APIs
Maven - Build Tool