赞
踩
org.springframework.kafka
spring-kafka
spring-kafka version会使用spring boot 对应版本
启用spring-kafka
在spring boot 配置类上添加
@EnableKafka
配置kafka
在application.properties中添加配置
生产者
#Kafka producer
spring.kafka.producer.bootstrap-servers=168.61.2.47:9092,168.61.2.48:9092,168.61.2.49:9092
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.ByteArraySerializer
spring.kafka.producer.batch-size=65536
spring.kafka.producer.buffer-memory=524288
消费者者
#Kafka consumer
spring.kafka.consumer.group-id=thfx00
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.bootstrap-servers=168.61.2.47:9092,168.61.2.48:9092,168.61.2.49:9092
spri
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。