emqx_plugin_kafka.hocon 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. plugin_kafka {
  2. connection {
  3. bootstrap_hosts = ["192.168.2.207:9092"]
  4. // optional default:5s
  5. connect_timeout = 5s
  6. // enum: per_partition | per_broker
  7. // optional default:per_partition
  8. connection_strategy = per_partition
  9. // optional default:5s
  10. min_metadata_refresh_interval = 5s
  11. // optional default:true
  12. query_api_versions = true
  13. // optional default:3s
  14. request_timeout = 3s
  15. sasl {
  16. mechanism = plain
  17. username = "admin"
  18. password = "Welamp@2025"
  19. }
  20. ssl {
  21. enable = false
  22. }
  23. health_check_interval = 32s
  24. }
  25. // optional
  26. producer {
  27. // Most number of bytes to collect into a produce request.
  28. // optional default:896KB
  29. max_batch_bytes = 896KB
  30. // enum: no_compression | snappy | gzip
  31. // optional default:no_compression
  32. compression = no_compression
  33. // enum: random | roundrobin | first_key_dispatch
  34. // optional default:random
  35. partition_strategy = random
  36. // Encode kafka value.
  37. // enum: plain | base64
  38. // optional default:plain
  39. encode_payload_type = base64
  40. }
  41. hooks = [
  42. {
  43. // Hook point.
  44. // required
  45. endpoint = message.publish
  46. // Emqx topic pattern.
  47. // 1. Cannot match the system message;
  48. // 2. Cannot use filters that start with '+' or '#'.
  49. // message required
  50. filter = "/Lamp/DataReport/#"
  51. // Kafka topic, must be created in advance in Kafka.
  52. // required
  53. kafka_topic = log_info
  54. // Matching template, value = ${.} indicates that all keys match
  55. // optional default:{timestamp = "${.timestamp}", value = "${.}",key = "${.clientid}"}
  56. kafka_message = {
  57. timestamp = "${.timestamp}"
  58. value = "${.}"
  59. key = "${.clientid}"
  60. }
  61. }
  62. ]
  63. }