diff --git a/couplet-modules/couplet-analyze/couplet-analyze-incident/pom.xml b/couplet-modules/couplet-analyze/couplet-analyze-incident/pom.xml new file mode 100644 index 0000000..cc43d1a --- /dev/null +++ b/couplet-modules/couplet-analyze/couplet-analyze-incident/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + com.couplet + couplet-analyze + 3.6.3 + + + couplet-analyze-incident + + + 17 + 17 + UTF-8 + + + diff --git a/couplet-modules/couplet-analyze/couplet-analyze-msg/pom.xml b/couplet-modules/couplet-analyze/couplet-analyze-msg/pom.xml new file mode 100644 index 0000000..2c78901 --- /dev/null +++ b/couplet-modules/couplet-analyze/couplet-analyze-msg/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + com.couplet + couplet-analyze + 3.6.3 + + + couplet-analyze-msg + + + 17 + 17 + UTF-8 + + + diff --git a/couplet-modules/couplet-msg/src/main/java/com/couplet/msg/domain/MsgData.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/msg/domain/MsgData.java similarity index 100% rename from couplet-modules/couplet-msg/src/main/java/com/couplet/msg/domain/MsgData.java rename to couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/msg/domain/MsgData.java diff --git a/couplet-modules/couplet-msg/src/main/java/com/couplet/msg/domain/TroubleLog.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/msg/domain/TroubleLog.java similarity index 100% rename from couplet-modules/couplet-msg/src/main/java/com/couplet/msg/domain/TroubleLog.java rename to couplet-modules/couplet-analyze/couplet-analyze-msg/src/main/java/com/couplet/msg/domain/TroubleLog.java diff --git a/couplet-modules/couplet-msg/src/test/java/com/couplet/msg/Main.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/test/java/com/couplet/msg/Main.java similarity index 100% rename from couplet-modules/couplet-msg/src/test/java/com/couplet/msg/Main.java rename to couplet-modules/couplet-analyze/couplet-analyze-msg/src/test/java/com/couplet/msg/Main.java diff --git a/couplet-modules/couplet-msg/src/test/java/com/couplet/msg/ParsingMsg.java b/couplet-modules/couplet-analyze/couplet-analyze-msg/src/test/java/com/couplet/msg/ParsingMsg.java similarity index 100% rename from couplet-modules/couplet-msg/src/test/java/com/couplet/msg/ParsingMsg.java rename to couplet-modules/couplet-analyze/couplet-analyze-msg/src/test/java/com/couplet/msg/ParsingMsg.java diff --git a/couplet-modules/couplet-msg/pom.xml b/couplet-modules/couplet-analyze/pom.xml similarity index 93% rename from couplet-modules/couplet-msg/pom.xml rename to couplet-modules/couplet-analyze/pom.xml index d826790..1e3d70e 100644 --- a/couplet-modules/couplet-msg/pom.xml +++ b/couplet-modules/couplet-analyze/pom.xml @@ -9,7 +9,12 @@ 3.6.3 - couplet-msg + couplet-analyze + pom + + couplet-analyze-incident + couplet-analyze-msg + 17 diff --git a/couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/pom.xml b/couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/pom.xml index c207416..0dbec53 100644 --- a/couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/pom.xml +++ b/couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/pom.xml @@ -89,6 +89,10 @@ com.couplet couplet-common-system + + org.apache.kafka + kafka-clients + diff --git a/couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/src/test/java/test.java b/couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/src/test/java/test.java new file mode 100644 index 0000000..58bc462 --- /dev/null +++ b/couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/src/test/java/test.java @@ -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 producer = new KafkaProducer<>(props); + for (int i = 0; i < 10; i++) { + producer.send(new ProducerRecord("my-topic",Integer.toString(i),Integer.toString(i))); + } + producer.close(); + } + + + +} diff --git a/couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/src/test/java/test2.java b/couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/src/test/java/test2.java new file mode 100644 index 0000000..1969ae1 --- /dev/null +++ b/couplet-modules/couplet-electronic-fence/couplet-electronic-fence-server/src/test/java/test2.java @@ -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 producer = new KafkaProducer(properties); + for (int i = 0; i < 10; i++) { + Future 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(); + + } + + +} diff --git a/couplet-modules/pom.xml b/couplet-modules/pom.xml index 2ef9b94..1ce01cd 100644 --- a/couplet-modules/pom.xml +++ b/couplet-modules/pom.xml @@ -18,7 +18,7 @@ couplet-modules-vehicle couplet-modules-mq couplet-enterprisemanagement - couplet-msg + couplet-analyze couplet-modules