Kafka integration with Java Spring-boot: producer-consumer model

Overview

Kafka integration with Java Spring-boot: producer-consumer model

Services

  • dog-rescuer (acts as a kafka producer)
  • dog-adoption-center (acts as a kafka consumer)

Flow

  • Dog-rescuer service creates a Dog POJO using java-faker and produces the created object to a Kafka topic (rescued-dogs-delivery) after every 2 minutes.
  • Dog-adoption-center consumes the messages from the Kafka topic, parses it and saves it to it's in-memory DB.
  • Dog-adoptiion-center exposes GET /dogs API to retreive all rescued dog records

Local Setup with Docker

  • Install Java 17 (recommended to use SdkMan)

sdk install java 17-open

  • Install Maven (recommended to use SdkMan)

sdk install maven

  • Clone the repo

git clone https://github.com/hardikSinghBehl/kafka-java-spring-boot-poc.git

  • Run the below command inside both services

mvn clean install

  • Run the below commands to start docker containers

sudo docker-compose build

sudo docker-compose up -d

  • Run the below command to stop docker containers

sudo docker-compose down


Sample Recording

kafka-producer-consumer-sample-recording-2.mov
You might also like...

Microservices with Spring Boot and Kafka Demo Project

Microservices with Spring Boot and Kafka Demo Project

Example microservices showing how to use Kafka and Kafka Streams with Spring Boot on the example of distributed transactions implementations with the SAGA pattern

Jan 7, 2023

Source code of Spring boot + Apache Kafka Udemy Course

Spring Boot + Apache Kafka - The Quickstart Practical Guide- Udemy course Course link: https://www.udemy.com/course/spring-boot-and-apache-kafka/?refe

Dec 21, 2022

An integration solution for Spring Cloud and Tencent middleware - Spring Cloud和腾讯中间件的集成方案

Spring Cloud Tencent English | 简体中文 Introduction Spring Cloud Tencent contains components distributed micro-service applications need during developin

Dec 29, 2022

Hi, Spring fans! In this installment we look Spring Integration's support for MQTT and the HiveMQ broker

Spring Integration MQTT & HiveMQ Hi, Spring fans! In this installment we look Spring Integration's support for MQTT and the HiveMQ broker. I'm joined

Nov 21, 2022

A high availability shopping(ecommerce) system using SpringBoot, Spring Cloud, Eureka Server, Spring Cloud Gateway, resillience4j, Kafka, Redis and MySQL.

A high availability shopping(ecommerce) system using SpringBoot, Spring Cloud, Eureka Server, Spring Cloud Gateway, resillience4j, Kafka, Redis and MySQL.

High-availability-shopping-system A high availability shopping(ecommerce) system using SpringBoot, Spring Cloud, Eureka Server, Spring Cloud Gateway,

Oct 26, 2022

Codebase for talk on Spring I/O 2022 in Barcelona about Spring for Apache Kafka

Codebase for talk on Spring I/O 2022 in Barcelona about Spring for Apache Kafka

Spring I/O Barcelona 2022 - Spring Kafka beyond the basics Codebase for my talk on Spring I/O 2022 in Barcelona about Spring for Apache Kafka Slides P

Dec 24, 2022

about learning Spring Boot via examples. Spring Boot 教程、技术栈示例代码,快速简单上手教程。

about learning Spring Boot via examples. Spring Boot 教程、技术栈示例代码,快速简单上手教程。

Spring Boot 学习示例 Spring Boot 使用的各种示例,以最简单、最实用为标准,此开源项目中的每个示例都以最小依赖,最简单为标准,帮助初学者快速掌握 Spring Boot 各组件的使用。 Spring Boot 中文索引 | Spring Cloud学习示例代码 | Spring

Jan 1, 2023

spring boot 实践学习案例,是 spring boot 初学者及核心技术巩固的最佳实践。另外写博客,用 OpenWrite。

spring boot 实践学习案例,是 spring boot 初学者及核心技术巩固的最佳实践。另外写博客,用 OpenWrite。

推荐工具: 微信公众号 Markdown 编辑器 - OpenWrite:Markdown 微信编辑器是一款专业强大的微信公众平台在线编辑排版工具,提供手机预览功能,让用户在微信图文 、文章、内容排版、文本编辑、素材编辑上更加方便。 - 更多介绍 博客群发平台 一、支持泥瓦匠 Spring Boot

Jan 5, 2023

Spring-Boot-Plus is a easy-to-use, high-speed, high-efficient,feature-rich, open source spring boot scaffolding

Spring-Boot-Plus is a easy-to-use, high-speed, high-efficient,feature-rich, open source spring boot scaffolding

Everyone can develop projects independently, quickly and efficiently! What is spring-boot-plus? A easy-to-use, high-speed, high-efficient, feature-ric

Dec 31, 2022
Owner
Hardik Singh Behl
Java Web Developer
Hardik Singh Behl
Kafka-spring-boot-starter: encapsulated based on spring-kafka

Encapsulation based on spring-kafka not only supports native configuration, but also adds multi data source configuration.

liudong 8 Jan 9, 2023
循序渐进,学习Spring Boot、Spring Boot & Shiro、Spring Batch、Spring Cloud、Spring Cloud Alibaba、Spring Security & Spring Security OAuth2,博客Spring系列源码:https://mrbird.cc

Spring 系列教程 该仓库为个人博客https://mrbird.cc中Spring系列源码,包含Spring Boot、Spring Boot & Shiro、Spring Cloud,Spring Boot & Spring Security & Spring Security OAuth2

mrbird 24.8k Jan 6, 2023
End to End project for Kafka Streams using Spring Cloud Kafka streams

Spring Kafka Streams using Spring Cloud Streams End to End example Endpoint http://localhost:8080/domain/lookup/facebook - to pull all facebook relate

TechPrimers 43 Dec 20, 2022
Docker-compose-integration-tstst - An exploration of how to run integration tests against an application that has inconvenient external dependencies (e.g. a SQL database).

Tstst? it was supposed to be docker-compose-integration-tests but i was too lazy to fix it at the outset, and now im trying to convince myself its fun

null 1 Jan 4, 2022
Framework for automated integration tests with focus on messaging integration

Citrus Integration Testing Welcome to Citrus Citrus is a test framework written in Java that is able to create fully automated end-to-end use case tes

Citrus Framework 373 Dec 27, 2022
Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example

Spring Boot Login example with Spring Security, MySQL and JWT Appropriate Flow for User Login and Registration with JWT Spring Boot Rest Api Architect

null 58 Jan 5, 2023
Spring Boot OAuth 2.0 Client Implementation + MySQL Integration

Spring Boot OAuth 2.0 Client + MySQL 1. What is OAuth 2.0 ? The OAuth 2.0 authorization framework enables a third-party application to obtain limited

Salah Eddine Zemmouri 8 May 12, 2022
LOQUI - Real-time chat application built using Apache Kafka, Java, Spring Boot, SockJS and React

LOQUI is a simple real-time chat application that demonstrates how to use Apache Kafka as a message broker along with Java, Spring Boot and React on the front-end

Castanho Correia 2 Jun 5, 2022
A Spring Boot Camel boilerplate that aims to consume events from Apache Kafka, process it and send to a PostgreSQL database.

SPRING-BOOT CAMEL BOILERPLATE This is a Spring-Boot Camel Application model that you can use as a reference to study or even to use in your company. I

Bruno Delgado 45 Apr 4, 2022
Spring Boot Debezium Kafka PostgreSQL Relationship

spring-boot-debezium-db-kafka Spring-Boot-Debezium-Kafka-PostgreSQL Relationship Installation First,Configure docker-compose.yml Second,Write Db-Kafka

null 2 Aug 26, 2022