Browse Source

rabbitMq database 调试通过

andy 1 year ago
parent
commit
33d1b937c3
1 changed files with 35 additions and 0 deletions
  1. 35 0
      src/test/java/com/scbfkj/uni/process/KafkaTest.java

+ 35 - 0
src/test/java/com/scbfkj/uni/process/KafkaTest.java

@@ -0,0 +1,35 @@
+package com.scbfkj.uni.process;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+
+class KafkaTest {
+
+    String config = """
+                            {
+              "bootstrap.servers": "120.26.64.82:9092",
+              "max.poll.records": "1000"
+            }""";
+
+    @Test
+    void receptionMessage() throws Exception {
+
+        while (true) {
+            System.out.println(Kafka.receptionMessage(config, "test01", "AAA"));
+            Thread.sleep(1000);
+        }
+    }
+
+    @Test
+    void sendMessage() throws Exception {
+        while (true) {
+            Kafka.sendMessage(config, "test01", new ArrayList<>() {{
+                for (int i = 0; i < 1000; i++) {
+                    add("hello" + i+":"+System.currentTimeMillis());
+                }
+            }});
+            Thread.sleep(1000);
+        }
+    }
+}