Skip to content

Encapsulation based on spring-kafka not only supports native configuration, but also adds multi data source configuration.

License

Notifications You must be signed in to change notification settings

pg-liudong/kafka-spring-boot-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English

Mybatis-Plus-Logo

基于spring-kafka进行封装,支持原生配置,支持多数据源配置。

maven code style

简介 | Intro

Kafka-spring-boot-starter 除了支持原生 spring-kafka 配置外,还增加了多数据源配置。

QQ:908942659 ; wechat:xin2014555

安装 | Install

<dependency>
  <groupId>io.github.pg-liudong</groupId>
  <artifactId>kafka-spring-boot-starter</artifactId>
  <version>1.0.5</version>
</dependency>

特征 | Features

  • 支持原生:支持spring-kafka原生配置。
spring:
  kafka:
    bootstrap-servers: localhost:9092
    consumer:
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      auto-offset-reset: earliest
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer
      value-serializer: org.apache.kafka.common.serialization.StringSerializer
  • 支持多数据源:支持多数据源配置。(配置粒度越小,优先级越高,遵循就近原则)
spring:
  kafka:
    multiple:
      # Primary data source is not allowed to be empty.
      primary: ds1  
      consumer:
        key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
        value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
        auto-offset-reset: latest
      producer:
        key-serializer: org.apache.kafka.common.serialization.StringSerializer
        value-serializer: org.apache.kafka.common.serialization.StringSerializer
      datasource:
        ds1:
          bootstrap-servers: localhost:9092
          consumer:
            # Consumer concurrent kafka listener container factory is not allowed to be empty.
            container-factory: ds1KafkaListenerContainerFactory  
            auto-offset-reset: earliest
          producer:
            kafka-template: ds1KafkaTemplate
        ds2:
          bootstrap-servers: localhost:9093
          consumer:
            container-factory: ds2KafkaListenerContainerFactory
            auto-offset-reset: earliest
          producer:
            # Producer kafka template bean name is not allowed to be empty.
            kafka-template: ds2KafkaTemplate 

演示 | Demo

捐赠 | Donate

如果觉得插件很赞,为你节约了不少时间,那么就请作者喝杯咖啡吧~☕☕☕,非常感谢!

微信 支付宝 Paypal

微信公众号 | WeChat official account

不定期分享编程技术干货笔记,不限于算法、数据库、Spring Boot、微服务、高并发、JVM、Docker、ELK、编程技巧等相关知识,期待与您共同进步!

微信公众号

About

Encapsulation based on spring-kafka not only supports native configuration, but also adds multi data source configuration.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages