xufei 3 gadi atpakaļ
vecāks
revīzija
0ca7b0e474
1 mainītis faili ar 43 papildinājumiem un 0 dzēšanām
  1. 43 0
      src/test/java/com/winhc/test/TestSendKafka.java

+ 43 - 0
src/test/java/com/winhc/test/TestSendKafka.java

@@ -0,0 +1,43 @@
+package com.winhc.test;
+
+import com.alibaba.fastjson.JSON;
+import com.winhc.kafka.KafkaProduce;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import java.util.HashMap;
+
+/**
+ * @author π
+ * @Description:司法案件测试
+ * @date 2021/09/17 16:24
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class TestSendKafka {
+    @Autowired
+    KafkaProduce kafkaProduce;
+
+    @Test
+    public void sendKafka() {
+        String topic = "inc_judicial_case_monitor";
+        long start = System.currentTimeMillis();
+        HashMap<Object, Object> map = new HashMap<>();
+        HashMap<Object, Object> map1 = new HashMap<>();
+        map.put("topic_type","1");
+        map1.put("justice_case_id","221111486");
+        map1.put("dimension_id","b97afac1bc2c9d6755413fa0069699e0");
+        map1.put("dimension_type","7");
+        map.put("data",map1);
+        String msg = JSON.toJSONString(map);
+        System.out.println(msg);
+        //kafkaProduce.produce(topic, msg);
+        System.out.println(System.currentTimeMillis() - start);
+    }
+
+
+}