NBIDataVis

1.配置pom包

<dependency>

  <groupId>org.springframework.kafka</groupId>

  <artifactId>spring-kafka</artifactId>

</dependency>

2.配置application.yml kafka部分:

kafka:    # 指定kafka 代理地址,可以多个

    bootstrap-servers: hadoop:9092, slave1:9092

    template:    # 指定默认topic id

      default-topic: producer

    listener:  # 指定listener 容器中的线程数,用于提高并发量

      concurrency: 5

    consumer:

      group-id: myGroup # 指定默认消费者group id

      client-id: 200

      max-poll-records: 200

      auto-offset-reset: earliest # 最早未被消费的offset

    producer:

      batch-size: 10 # 每次批量发送消息的数量

      retries: 3

      client-id: 200

3.定义生产者类:

 

4.定义消费者类:

 

5.定义生产者controller:

 

分类:

技术点:

相关文章:

  • 2021-11-04
  • 2022-01-10
  • 2021-11-30
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2021-11-30
猜你喜欢
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-04-29
  • 2021-12-11
相关资源
相似解决方案