feat():更新最新代码

master
张腾 2024-10-02 09:12:44 +08:00
parent af798f18e5
commit 87b3eccff5
6 changed files with 35 additions and 9 deletions

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.muyu</groupId>
<artifactId>cloud-common</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>cloud-common-kafka</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>3.0.0</version>
</dependency>
</dependencies>
</project>

View File

@ -1,4 +1,4 @@
package com.muyu.carData.config.kafkaconfig;
package com.muyu.kafkaconfig;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;

View File

@ -21,6 +21,7 @@
<module>cloud-common-xxl</module>
<module>cloud-common-rabbit</module>
<module>cloud-common-saas</module>
<module>cloud-common-kafka</module>
</modules>
<artifactId>cloud-common</artifactId>

View File

@ -83,9 +83,9 @@
<version>2.9.3</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>3.0.0</version>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-kafka</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>

View File

@ -16,7 +16,7 @@ import java.time.Duration;
import java.util.Collection;
/**
* @Author
* @Author
* @Packagecom.muyu.carData.consumer
* @Projectcloud-server-8
* @nameMyKafkaConsumer
@ -43,10 +43,7 @@ public class MyKafkaConsumer implements InitializingBean {
for (ConsumerRecord<String, String> consumerRecord : consumerRecords) {
//从consumerRecord中获取消费数据
String value = consumerRecord.value();
log.info("从Kafka中消费的原始数据{}",value);
//转换为java对象
Student stu = JSONUtil.toBean(value, Student.class);
log.info("消费数据转换为Java对象{}",stu);
log.info("从Kafka中消费的原始数据===============>>{}",value);
}
}
});