springboot集成Kafka

1.搭建就不多说了

以后会有篇章

2.下载依赖

        
            org.springframework.kafka
            spring-kafka
        

3.yaml

spring:
  kafka:
    bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS:192.168.202.178:9092} # kafka地址
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer # key序列化
      value-serializer: org.springframework.kafka.support.serializer.JsonSerializer  # value序列化
      retries: 0 # 重试次数
    consumer:
      auto-offset-reset: latest # 偏移量重置至最新消息
      enable-auto-commit: true # 自动提交偏移量
      key-deserializer: org.apache.kafka.common.serializ

你可能感兴趣的:(中间件实战,spring,boot,kafka,linq)