
Discover the fundamentals of Spring Kafka, including installation, configuration, and essential concepts for building efficient messaging applications. Gain hands-on experience in creating producers and consumers, facilitating seamless communication within your microservices architecture.
This course covers Kafka fundamentals with Spring Boot, Kafka in microservices, Kafka Connect, schema registry, KSQLDB, and offers practical examples, tools, and resources for different learning
The course provides access to source code and scripts in the "Resources and Reference" section, along with a Postman collection for convenience. Minor differences between the video and source code may occur due to updates, but these should not affect application functionality.
Maximize value by creating a comfortable study setup, pausing to understand code, and using subtitles and playback speed. Consult Q&A, Stack Overflow, or Google when you get stuck.
In this course, you'll write code for Spring and Kafka, with optional support from GitHub Copilot, an AI assistant. You'll learn how Copilot enhances coding by providing real-time suggestions, alongside its limitations. The course content remains complete whether you choose to use AI or not.
Explore artificial intelligence and large language models, including ChatGPT and GitHub Copilot, and learn prompt engineering to design inputs that yield optimal outputs.
This lesson focusing on leveraging AI and large language models (LLMs) to enhance data processing and messaging solutions.
Understand how large language models like ChatGPT and Github Copilot assist coding, highlight non-deterministic responses, and require human validation and critical evaluation using paid tools and prompts.
Download prompts and source code from the resources section, noting the code is for reference, not absolute solutions; updates may cause minor differences, but materials remain usable.
Explore the fundamentals of prompt engineering to enhance decision-making processes and improve system interactions, enabling you to build more efficient and intelligent applications using Generative AI.
Understand how Generative AI and, specifically, AI assistants change the way software engineers work and how you can utilize them to improve productivity.
Understand how Generative AI and, specifically, AI assistants change the way software testers work and how you can utilize them to improve productivity.
The basic of ChatGPT and GitHub Copilot, learning how to harness these powerful tools to enhance application development and streamline communication within your projects effectively.
Learn how to set up ChatGPT and GitHub Copilot. This lesson equips you with the essential tools for efficient development and enhances your productivity in working with Kafka.
using Kafka for building messaging systems, covering essential concepts, configurations, and practical implementation techniques to effectively manage data streams and enhance communication between applications
provides an overview of Kafka, its architecture, and its core functionalities, emphasizing how to leverage it within Spring applications for effective messaging and data streaming solutions.
Java applications using Spring framework, enabling developers to build scalable and robust messaging systems
the installation process of Java for Spring Kafka, guiding users through the necessary steps to set up their development environment for efficient programming and integration with Kafka.
guides users through the process of setting up Kafka on their development machines, ensuring they have the necessary environment to begin working with the framework.
Using docker to ease application installations
the installation and running of Kafka using Docker
the installation process of Visual Studio Code, providing step-by-step guidance to help users set up the IDE for developing applications using Spring Kafka effectively.
integrating GenAI Assistant (Github Copilot) with Visual Studio Code, utilizing GitHub Copilot to enhance development efficiency and streamline the process of building applications that leverage Kafka messaging capabilities.
Understanding Apache kafka basic concepts, such as topic, partition, publisher, consumer
explains the roles within Apache Kafka, where a producer (or publisher) sends messages to a storage system organized into topics, partitions, and offsets, while a subscriber (or consumer) monitors these topics for new messages. It emphasizes the importance of understanding the interchangeable terminology used in Kafka.
understanding Kafka topic partition and offsets, explaining how data is stored in Kafka, the significance of offsets in message consumption, and how they impact data retrieval and processing efficiency.
focusing on the producer component, exploring its functionalities, configuration, and efficient message sending strategies within a Spring application
understanding Kafka consumers, their functionalities, and the structure of consumer groups to effectively manage message processing in a Spring application.
The video discusses the consumer offset delivery semantics in Spring Kafka 5, explaining how offsets are managed for message consumption, ensuring messages are processed reliably and providing options for handling failures in message delivery.
exploration of Zookeeper in the context of Spring Kafka
using Spring Boot for Java development, highlighting its configuration simplicity and dependency management through Gradle. Participants will generate two Spring Boot projects for Kafka producers and consumers using Spring Initializr, customize application properties, and shift from properties files to YML for better readability
how to create and manage Kafka topics and partitions using command line instructions, specifically within a Docker environment on Windows. It covers commands for creating, listing, and deleting topics, using examples such as creating the topics "t-hello" and "t-test".
The lesson guides the creation of a Kafka producer and consumer using Spring, demonstrating the setup of Java classes and proper annotations for publishing and consuming messages, while also explaining how to configure application properties and run tests in Visual Studio Code. It touches on utilizing KafkaTemplate for the producer and @KafkaListener for the consumer, emphasizing the organization of code and troubleshooting common errors
This lesson teaches users how to effectively interact with GitHub Copilot to generate Java code for a Kafka producer and consumer, emphasizing the importance of maintaining valid code structure and understanding that the AI's suggestions should be critically evaluated by the user. The lesson covers using both dedicated chat and inline chat prompts to generate code, verifying that the generated code compiles and functions correctly.
In this lecture, participants learn to create a Kafka topic named "t-fixedrate" and implement a producer class, FixedRateProducer, that sends incremental numbers to Kafka every second using Spring Boot's scheduling features. Additionally, they set up a consumer class, FixedRateConsumer, to process messages in real time, confirming the consumer's ability to handle messages as they arrive.
This lesson focuses on creating a Kafka producer and consumer using Spring, highlighting how to utilize GitHub Copilot for code suggestions while emphasizing the importance of human oversight in the coding process. It covers the implementation of a producer that sends messages every second and a consumer that receives those messages, along with instructions for enabling and disabling services in preparation for future lessons.
various methods to effectively use GitHub Copilot in Visual Studio Code, highlighting its autocomplete, chat features, and the importance of validating AI-generated code. It emphasizes that while GitHub Copilot is more convenient for coding, ChatGPT can still be utilized, albeit with challenges in switching between the coding environment and the web browser.
outlines the process of configuring a Kafka consumer to start consuming messages from a specified offset, using the "earliest" setting to ensure all prior messages are processed. It details the creation of a new topic, the setup of a producer and consumer, and emphasizes the importance of managing annotations to control message flow during the lesson.
The lesson focuses on creating a Kafka producer that sends messages with keys to a topic with three partitions, ensuring messages with the same key are routed to the same partition. It also involves using Kafka console consumers to demonstrate and verify that the data distribution based on keys consistently maps to the designated partitions.
The lesson covers how to efficiently manage message processing in Kafka by using multiple concurrent consumers, highlighting the effect of increasing the number of consumers relative to topic partitions, and demonstrating how to optimize throughput by matching the number of consumers to partitions. It emphasizes that adding concurrency is simple with Spring and explains the consequences of partition management in Kafka.
The caption discusses the challenges of using different message formats in Kafka, highlighting the complexities for consumers that arise when multiple producers publish data with varying delimiters. It emphasizes the benefits of standardizing data interchange with JSON, which simplifies parsing and allows applications to focus on business logic, and outlines the use of the Jackson library for JSON processing in Java projects.
In this lesson, you will create a Kafka topic named "t-employee" and implement a Spring Boot application that produces JSON serialized Employee objects, including setting up necessary dependencies and configurations using Jackson for LocalDate support. You'll also generate dummy employee data and verify its publication to the Kafka topic.
The course discusses how to customize JSON output in Jackson by using annotations to change attribute names and date formats, emphasizing the importance of adhering to standards like ISO 8601 for consistency in REST APIs and messaging systems. It provides practical steps to implement these customizations, including configuring the ObjectMapper and adjusting the producer application for Kafka.
steps to set up a Kafka consumer for handling employee data in JSON format, including adding necessary dependencies, configuring settings, creating an EmployeeJsonConsumer class, and using ObjectMapper to convert JSON strings to Java objects. It emphasizes copying existing configurations and classes from a producer project to streamline the process.
In this lesson, we implemented a consumer with consumer groups in a Kafka setup, utilizing a producer that publishes commodity data to a topic ("t-commodity") and creating two separate consumer groups for dashboard updates and notifications. We developed a service to generate and manage dummy commodities, set up a REST API for accessing these commodities, and built a scheduler to periodically pull data from the API and send it to Kafka.
the steps to create two Kafka consumers in a project, one for dashboard updates and another for notifications, demonstrating how each consumer operates independently within their respective groups and can process messages simultaneously without blocking each other, even with simulated delays. It emphasizes the importance of consumer groups in managing message consumption from Kafka.
the consumption and offset commitment process in Kafka, explaining how different consumer groups can have varied strategies for committing offsets based on their configurations. It emphasizes the importance of managing offsets for replaying data, dealing with consumer lag, and ensuring efficient message processing, while showcasing practical examples using a counter topic and consumers with differing acknowledgment modes.
configuring Kafka properties for producer and consumer applications using Spring, highlighting how to set specific configurations in the application.yml file and customize properties using Java code by overriding ProducerFactory and ConsumerFactory. Users are guided through examples of setting differing "metrics.num.samples" values for the producer and consumer and how to inspect these configurations during application runtime.
afka serves as a robust data communication backbone, utilizing clusters of multiple brokers to ensure data durability and fault tolerance through replication. A replication factor, usually between two and three, allows data to be copied across brokers, maintaining accessibility and reliability even in the event of broker failures.
In this lesson, we learn about Kafka producer acknowledgments, which determine how data is confirmed as written to brokers, with options ranging from no acknowledgment (acks=0) to requiring confirmations from all replicas (acks=all or -1), impacting data safety and throughput. Proper settings like "min.insync.replicas" enhance data reliability by ensuring a minimum number of replicas acknowledge the data.
discusses the process of rebalancing in Kafka, which redistributes partition assignments among consumers in response to events like consumer joins/leaves or partition count changes, highlighting two main strategies: eager and cooperative rebalancing. It emphasizes the benefits and drawbacks of each approach, including temporary unavailability during rebalancing and the importance of static group membership for efficient operation.
the implementation of a Kafka messaging system for a car fleet where location data is sent to a topic, processed by two listeners—one that processes all messages and another that filters messages based on a distance criterion. It includes creating a producer and consumer to send and receive car location data, along with configuring a custom message filtering strategy using Spring Kafka.
describes the implementation of an idempotent Kafka consumer to handle potential duplicate messages in a purchase request context by using caching to filter out already processed requests. It emphasizes the importance of preserving message processing order and outlines how to leverage Kafka features and a caching library like Caffeine to prevent double-processing of purchase requests.
implementing a system to filter duplicate payment requests by generating a unique cache key using a combination of specific fields (amount, currency, and bank account) instead of the entire object. It describes the process of creating a producer to send payment requests and a consumer to receive them, ensuring that duplicates are identified and skipped based on the cache key, while eight messages are still recorded in the Kafka topic.
the implementation of a Kafka message consumer designed to ensure idempotency by using a message filter that checks a cache to prevent duplicate processing of payment requests. It outlines the creation of a custom listener factory and adjustments to the consumer class to streamline cache access, resulting in the consumer processing only unique messages from published requests.
discusses exception handling in a food order application using Kafka, focusing on both producer and consumer sides, and emphasizes the implementation of a custom error handler to manage exceptions effectively, such as logging errors or sending details to external systems like Elasticsearch. It demonstrates creating a FoodOrder class, producing order messages, consuming them, and handling exceptions when the order amount exceeds limits, showcasing the default behavior of Spring and how to customize the error handling process.
the process of implementing a common error handler for Kafka consumers using Spring, demonstrating an example with two consumers: a FoodOrderConsumer and a SimpleNumberConsumer, the latter of which throws exceptions for odd numbers. It explains the creation of a CommonKafkaErrorHandler to log errors universally and highlights the need for re-throwing exceptions in the FoodOrderErrorHandler to allow shared error handling.
In this lesson, we explore advanced error handling in a Kafka consumer setup, demonstrating how to implement a retry mechanism for API calls that may fail, particularly when consuming messages related to images. The consumer is designed to retry the operation up to three times with a 10-second interval before moving on to the next message, ensuring efficient handling of errors without halting the entire consumption process.
the implementation of a dead letter topic in a Kafka messaging system, where failed invoice messages are retried up to five times before being sent to a designated dead letter topic (t-invoice-dead) for further processing. This enables the handling of both non-technical and permanent technical issues in message processing, allowing for efficient error management and notification to relevant stakeholders.
the implementation of a non-blocking retry mechanism in a Kafka message consumer using Spring, allowing the processing of independent messages while handling retries in the background. It includes steps for creating a new topic, configuring producers and consumers, and utilizing the @RetryableTopic and @Backoff annotations to manage retries and dead-letter topics effectively.
Major Update :
The whole course was re-recorded using better audio quality and natural English.
Now uses Spring Boot 3
Learn how to use AI Assistant (Github Copilot) to develop Spring application and Kafka
Additional course lectures
New Update 2 :
Learn everything about Kafka in a single course:
Rewrite all lectures for better audio quality
Update the Spring version to 2.6.x
Update Kafka version to 3.x
Newer alternative for deprecated syntax on Spring Kafka
Learn about Kafka Connect. How can it fit into system architecture, and how easy is it to ingest data from/to Kafka using Kafka Connect? With real-world sample hands-on
Learn about KsqlDB. How it can help speed up kafka usage, even for a team that does not know the Java programming language
The whole sections are integrated. Learn how to integrate Kafka Connect + Kafka Schema Registry + Kafka Stream + KsqlDB
New Update :
Learn how to use avro with spring Kafka and manage avro schema with confluent schema registry.
Write producer & consumer without coding using Kafka REST Proxy
Find out how Kafka fits into microservice architecture.
How to use Kafka along with REST API & Database transaction
Kafka Stream:
real-time data transformation within Apache Kafka
joining stream
joining table
joining stream-table
global table
Exactly-Once Semantic
Messaging System
Nowadays, we work with multiple systems and data that run among them. It's common for one system to trigger another system(s) process, or data needs to be transferred among systems. Whether your systems are built on monolith or microservice, whatever database you use, you need data moving from one point to another. And you need those movements FAST to be processed immediately (otherwise, your life will be ruined).
That kind of demand is so common, and fortunately, today's technology has an answer for it. Say hello to messaging systems, where you can send messages easily from one system to another system(s) asynchronously, in an almost real-time interval. There are some popular messaging systems in the market, and in this course, we will be talking about one of the most popular: Apache Kafka.
Apache Kafka
Apache Kafka is like a central hub where you place all data from the source system(s), and the other corresponding systems take the data and process it. It is open-source, reliable, and able to work on clusters. It has a small learning curve to start, yet it is powerful enough for system integrations.
This course includes everything you need to know about basic Apache Kafka, and implementation using Java (Spring Framework). After finishing this course, you should be able to install, configure, and use Apache Kafka from the Java Program. In this course, we will walk through detailed step-by-step from concept to hands-on Java coding. Given such a way, you will learn to understand its logic and experience how things are done using Apache Kafka and Java source codes.
Java and Spring Boot
Java has been a popular language for years. It is recognized as the world's most used programming language by several programming language indexes. Due to its popularity and long history, Java has many open source projects or frameworks to help developers work more efficiently.
One popular Java framework is the Spring Framework. Over the years, It has grown substantially among the Java community. Almost all software components required by a Java application are available within the Spring Framework. However, configuring Spring requires some effort. This involves setting up library dependencies and configuring the required Java Spring beans using XML or annotations in Java code. Spring developers soon realized that it is possible to automate much of this work.
So, in 2014, Spring Boot 1.0 was released for the Java community. Spring Boot gives Java programmers many automatic helpers and led to the quick large-scale adoption of the project by Java developers.
Spring provides good support for Kafka and the abstraction layers to work with over the native Kafka Java clients. With Spring, developing applications to interact with Apache Kafka is becoming easier.
Github Copilot as AI Assistant
GitHub Copilot can streamline Java development with Spring Boot and Apache Kafka by suggesting code snippets, generating boilerplate code, and offering best practices. It helps set up Kafka producers and consumers, configure Spring Boot applications, and integrate Kafka for real-time data processing. Copilot’s contextual suggestions improve productivity and reduce errors by providing relevant code examples and automated completions, enhancing development speed and code quality in your Java projects.
What You Will Get
After finishing the course, you will learn:
Installation of Apache Kafka and Java for development environment
How to use AI Assistant (Github Copilot) to boost your coding productivity
Apache Kafka key concepts
Create publisher and consumer using Java (Spring Boot)
Basic error handler if there is a failure during processing of Apache Kafka message
Basic understanding of how Kafka fit into Microservice Architecture
The course explains not only the theory of Apache Kafka but also a lot of hands-on coding to get your hands dirty and your brain working. Whether you are a hobbyist, beginner, or experienced developer, this course will surely add value to you!
Road to Microservices
Message broker is an important pillar of microservice architecture. In microservices, we use asynchronous messaging for inter-service communication. Services communicate by exchanging messages over messaging channels like Apache Kafka.
In this course, you will learn the theory and hand-code of messaging with Apache Kafka, a microservice architecture communication pillar.
Later on, you can learn more about Microservice Architecture & Patterns, with Kafka as an important component.