yr 2 лет назад
Родитель
Сommit
d614083dde
3 измененных файлов с 29 добавлено и 15 удалено
  1. 1 1
      priv/example/exmaple_1.hocon
  2. 28 0
      priv/example/example_2.hocon
  3. 0 14
      priv/example/exmaple_2.hocon

+ 1 - 1
priv/example/exmaple_1.hocon

@@ -35,7 +35,7 @@ plugin_kafka {
       kafka_topic = emqx_msg_publish
       kafka_message = {
         timestamp = "${.timestamp}"
-        value = "${.}"
+        value = "${.payload}"
         key = "${.clientid}"
       }
     }

+ 28 - 0
priv/example/example_2.hocon

@@ -0,0 +1,28 @@
+plugin_kafka {
+  connection {
+    bootstrap_hosts = ["10.3.64.223:9192"]
+    sasl {
+      mechanism = plain
+      username = "username"
+      password = "password"
+    }
+  }
+
+  producer {
+    encode_payload_type = base64
+  }
+
+  hooks = [
+    {endpoint = client.connect}
+    , {
+      endpoint = message.publish
+      filter = "test/#"
+      kafka_topic = emqx_msg_publish
+      kafka_message = {
+        timestamp = "${.timestamp}"
+        value = "{topic:${.topic},payload:${.payload},qos:${.qos}}"
+        key = "${.clientid}"
+      }
+    }
+  ]
+}

+ 0 - 14
priv/example/exmaple_2.hocon

@@ -1,14 +0,0 @@
-plugin_kafka {
-  connection {
-    bootstrap_hosts = ["10.3.64.223:9192"]
-    sasl {
-      mechanism = plain
-      username = "username"
-      password = "password"
-    }
-  }
-
-  hooks = [
-    {endpoint = client.connect}
-  ]
-}