Springboot kafka example

Overview

spring-boot-kafka-example

#Kafka kurulumu

download

Zookeeper server başlatmak için aşağıdaki komutunu çalıştırın

windows

./bin/windows/zookeeper-server-start.bat ./config/zookeeper.properties 

linux

./bin/zookeeper-server-start.sh  ./config/zookeeper.properties

Kafka instance başlatmak için

windows

./bin/windows/kafka-server-start.bat ./config/server.properties 

linux

./bin/kafka-server-start.sh ./config/server.properties 

Dependency information

Aşağıdaki dependecy pom.xml dosyasına ekleyin

	<!-- Spring kafka dependency -->
	<dependency>
		<groupId>org.springframework.kafka</groupId>
		<artifactId>spring-kafka</artifactId>
	</dependency>

Kafka Architecture

Kafka configs

Kafka Consumers/Producers configurasyonu için projenizin application.properties/application.yml file dosyalarını aşağıdaki satırları ekleyiniz.

spring.kafka.topic=<topic-name>
spring.kafka.topic.group.id=<consumer-group-id>

## kafka consumer config ##
spring.kafka.consumer.bootstrap-servers=localhost:9092
spring.kafka.consumer.group-id=${spring.kafka.topic.group.id}
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.ErrorHandlingDeserializer
spring.kafka.consumer.properties.spring.deserializer.value.delegate.class: org.springframework.kafka.support.serializer.JsonDeserializer
spring.kafka.consumer.properties.spring.json.value.default.type=com.java.techhub.kafka.demo.model.UserDetails

## kafka producer config ##
spring.kafka.producer.bootstrap-servers=localhost:9092
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer

## Optional configuration ##
spring.kafka.producer.client-id=producer-${random.uuid}
spring.kafka.consumer.client-id=consumer-${random.uuid}

console consumer/producer

Console üzerinden mesaj göndermek

./bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic otunctan-notification-message-topic
>{"id":656,"content":"sent message content"}

Topic consumer log

./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic otunctan-notification-message-topic

#Author

OZAY TUNÇTAN
You might also like...

Spring Boot Debezium Kafka PostgreSQL Relationship

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

Aug 26, 2022

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

LOQUI - Real-time chat application built using Apache Kafka, Java, Spring Boot, SockJS and React

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

Jun 5, 2022

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

Kafka integration with Java Spring-boot with one application serving as a producer and the other consuming the messages

Apr 26, 2022

httpx - CLI to test HTTP/gRPC/RSocket/Kafka... services by HTTP DSL

httpx: CLI for run http file httpx is a CLI to execute requests from JetBrains Http File. Request types supported by httpx HTTP REST PUB/SUB - Apache

Dec 15, 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

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

基于SpringCloud2.1的微服务开发脚手架,整合了spring-security-oauth2、nacos、feign、sentinel、springcloud-gateway等。服务治理方面引入elasticsearch、skywalking、springboot-admin、zipkin等,让项目开发快速进入业务开发,而不需过多时间花费在架构搭建上。持续更新中

基于SpringCloud2.1的微服务开发脚手架,整合了spring-security-oauth2、nacos、feign、sentinel、springcloud-gateway等。服务治理方面引入elasticsearch、skywalking、springboot-admin、zipkin等,让项目开发快速进入业务开发,而不需过多时间花费在架构搭建上。持续更新中

快速开始 先决条件 首先本机先要安装以下环境,建议先学习了解springboot和springcloud基础知识。 git java8 maven 开发环境搭建 linux和mac下可在项目根目录下执行 ./install.sh 快速搭建开发环境。如要了解具体的步骤,请看如下文档。 具体步骤如下:

Jan 6, 2023

springboot 框架与其它组件结合如 jpa、mybatis、websocket、security、shiro、cache等

致歉 由于自己懒以及身体对issuse 解决的不及时。请大家以后提issuse 的时候写清楚 模块名 比如“springboot-SpringSecurity4” 和问题,我会抽时间抓紧解决。 springboot-SpringSecurity0 包含两部分代码: 第一是 博客 springboot

Jan 5, 2023
Owner
Ozay TUNÇTAN
Ozay TUNÇTAN
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
🦄 开源社区系统:基于 SpringBoot + MyBatis + MySQL + Redis + Kafka + Elasticsearch + Spring Security + ... 并提供详细的开发文档和配套教程。包含帖子、评论、私信、系统通知、点赞、关注、搜索、用户设置、数据统计等模块。

Echo — 开源社区系统 项目上线到服务器之后可能会出现各种各样的 BUG,比如 Elasticsearch 服务启动失败导致搜索模块不可用,但是在本地运行是完全没问题的,所以各位小伙伴可以放心下载部署。 ?? 项目简介 Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java Web

小牛肉 434 Jan 7, 2023
消息推送平台 - 所使用的技术栈包括:SpringBoot、SpringDataJPA、MySQL、Docker、docker-compose、Kafka、Redis、Apollo、prometheus、Grafana、GrayLog等等

项目介绍 austin项目核心功能:发送消息 项目出现意义:只要公司内有发送消息的需求,都应该要有类似austin的项目,对各类消息进行统一发送处理。这有利于对功能的收拢,以及提高业务需求开发的效率 系统项目架构 austin项目核心流程:austin-api接收到发送消息请求,直接将请求进MQ。a

Java3y 2.9k Dec 31, 2022
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,

LeiH 1 Oct 26, 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 Security Login example with JWT and H2 example

Spring Boot Security Login example with JWT and H2 example Appropriate Flow for User Login and Registration with JWT and HttpOnly Cookie Spring Boot R

null 50 Dec 21, 2022
This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practical coding example and required JAR dependencies

SpringMVC-Database-Integration This module explains about the example of Spring MVC + Database Integration with MySQL using Hibernate ORM with practic

GowthamRaj K 3 Nov 2, 2021
【咕泡学院实战项目】-基于SpringBoot+Dubbo构建的电商平台-微服务架构、商城、电商、微服务、高并发、kafka、Elasticsearch

咕泡商城- 微服务架构实战 咕泡商城是咕泡学院 Java架构课程中,帮助学员对于技术更好落地的一个实战项目,项目基于springboot2.1.6.RELEASE+Dubbo2.7.3 来构建微服务。 业务模块划分,尽量贴合互联网公司的架构体系。所以,除了业务本身的复杂度不是很高之外,整体的架构基本

Mic 4.5k Dec 26, 2022
:herb: 基于springboot的快速学习示例,整合自己遇到的开源框架,如:rabbitmq(延迟队列)、Kafka、jpa、redies、oauth2、swagger、jsp、docker、spring-batch、异常处理、日志输出、多模块开发、多环境打包、缓存cache、爬虫、jwt、GraphQL、dubbo、zookeeper和Async等等:pushpin:

欢迎大家留言和PR~ Tip: 技术更新换代太快,本仓库仅做参考,自己的项目具体使用哪个版本还需谨慎思考~(不推荐使用最新的版本,推荐使用(最新-1|2)的版本,会比较稳定) spring-boot-quick 前言   自己很早就想搞一个总的仓库就是将自己平时遇到的和学习到的东西整合在一起,方便后

wangxc 2.1k Jan 2, 2023
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