chore: 新增解析系统模块
parent
313fd4aa54
commit
5148ae5e14
|
@ -0,0 +1,20 @@
|
||||||
|
<?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.couplet</groupId>
|
||||||
|
<artifactId>couplet-analyze</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>couplet-analyze-incident</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>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?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.couplet</groupId>
|
||||||
|
<artifactId>couplet-analyze</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>couplet-analyze-msg</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>
|
||||||
|
|
||||||
|
</project>
|
|
@ -9,7 +9,12 @@
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>couplet-msg</artifactId>
|
<artifactId>couplet-analyze</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<modules>
|
||||||
|
<module>couplet-analyze-incident</module>
|
||||||
|
<module>couplet-analyze-msg</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
|
@ -89,6 +89,10 @@
|
||||||
<groupId>com.couplet</groupId>
|
<groupId>com.couplet</groupId>
|
||||||
<artifactId>couplet-common-system</artifactId>
|
<artifactId>couplet-common-system</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.kafka</groupId>
|
||||||
|
<artifactId>kafka-clients</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||||
|
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/4/1
|
||||||
|
* 异步发送
|
||||||
|
*/
|
||||||
|
public class test {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
Properties props = new Properties();
|
||||||
|
props.put("bootstrap.servers","39.103.133.136:9092");
|
||||||
|
//使用默认的配置
|
||||||
|
// props.put("acks","all");
|
||||||
|
// props.put("retries",0);
|
||||||
|
// props.put("batch.size",16384);
|
||||||
|
// props.put("linger.ms",1);
|
||||||
|
// props.put("buffer.memory",33554432);
|
||||||
|
props.put("key.serializer","org.apache.kafka.common.serialization.StringSerializer");
|
||||||
|
props.put("value.serializer","org.apache.kafka.common.serialization.StringSerializer");
|
||||||
|
KafkaProducer<String, String> producer = new KafkaProducer<>(props);
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
producer.send(new ProducerRecord<String,String>("my-topic",Integer.toString(i),Integer.toString(i)));
|
||||||
|
}
|
||||||
|
producer.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||||
|
import org.apache.kafka.clients.producer.Producer;
|
||||||
|
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||||
|
import org.apache.kafka.clients.producer.RecordMetadata;
|
||||||
|
import org.yaml.snakeyaml.introspector.Property;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/4/1
|
||||||
|
* 同步发送
|
||||||
|
*/
|
||||||
|
public class test2 {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
Properties properties = new Properties();
|
||||||
|
properties.put("bootstrap.servers", "39.103.133.136:9092");
|
||||||
|
properties.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
|
||||||
|
properties.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
|
||||||
|
KafkaProducer<String, String> producer = new KafkaProducer<String, String>(properties);
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
Future<RecordMetadata> result = producer.send(new ProducerRecord<>("test", Integer.toString(i), Integer.toString(i)));
|
||||||
|
try {
|
||||||
|
RecordMetadata recordMetadata =result.get();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (ExecutionException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
producer.close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
<module>couplet-modules-vehicle</module>
|
<module>couplet-modules-vehicle</module>
|
||||||
<module>couplet-modules-mq</module>
|
<module>couplet-modules-mq</module>
|
||||||
<module>couplet-enterprisemanagement</module>
|
<module>couplet-enterprisemanagement</module>
|
||||||
<module>couplet-msg</module>
|
<module>couplet-analyze</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>couplet-modules</artifactId>
|
<artifactId>couplet-modules</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue