Article directory
Summary
Birth background
A brief introduction to the background. At present, Kafka is the main message queue in our company.
JQ uses both internal and external network cards. DD inside, SFZQJQ external network card, DD consumption is not enough.
At the same time, DD needs to consume messages in a specific format, which is the background of this demand.
Business processes:
Consumption Kafka - > Processing messages in a specific format - > Sending to DDKafka
Environmental Science
IDE: IntelliJ IDEA 2017.3.4
Jdk: 1.8
Maven: 3.5.2
SpringBoot: 2.1.8.RELEASE
Kafka: 2.2.0.RELEASE
Don't say much, just open your mouth.
Cui Hua! Upper code
pom file
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.8.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.example</groupId> <artifactId>com.jhon</artifactId> <version>0.0.1-SNAPSHOT</version> <name>demo</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <!--<dependency>--> <!--<groupId>org.mybatis.spring.boot</groupId>--> <!--<artifactId>mybatis-spring-boot-starter</artifactId>--> <!--<version>2.1.0</version>--> <!--</dependency>--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.4</version> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!--Edition2.1 Report errors--> <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka</artifactId> <version>2.2.0.RELEASE</version> </dependency> <!--<dependency>--> <!--<groupId>net.sf.json-lib</groupId>--> <!--<artifactId>json-lib</artifactId>--> <!--<version>2.4</version>--> <!--<type>pom</type>--> <!--</dependency>--> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.47</version> </dependency> </dependencies> <!-- https://mvnrepository.com/artifact/com.github.aelstad/keccakj --> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> Note: Springboot2.x Integrated Kafka There will be problems with the version.
Entrance
github address: Add Link Description
last
The code is very low. Please leave your comments or suggestions below. I will read them one by one.