1.依赖
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile group: 'org.springframework.kafka', name: 'spring-kafka'
compile group: 'org.apache.kafka', name: 'kafka-streams'
/* swagger */
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: "${springfoxSwaggerVersion}"
compile group: 'io.springfox', name: 'springfox-swagger2', version: "${springfoxSwaggerVersion}"
}
2.配置
spring:
devtools:
restart:
enabled: true
#additional-exclude:
#additional-paths:
kafka:
#消息生产者配置
producer:
#客户端ID
client-id: producer
#kafka服务器
bootstrap-servers: localhost:9092
batch-size: 100
#缓冲内存大小
buffer-memory: 10000
#compression-type:
#是否应答,值为all, -1, 0, 1,当使用幂等生产者时必须设置为all
acks: all
#重试次数