docs(kafka_consumer): make specific labels for key/value encoding modes

https://emqx.atlassian.net/browse/EMQX-9312
This commit is contained in:
Thales Macedo Garitezi 2023-03-24 09:08:27 -03:00
parent ae2f02327d
commit 5bdc71af6f
2 changed files with 25 additions and 8 deletions

View File

@ -629,20 +629,37 @@ emqx_ee_bridge_kafka {
zh: "主题映射关系" zh: "主题映射关系"
} }
} }
consumer_encoding_mode { consumer_key_encoding_mode {
desc { desc {
en: "Defines how the key or value from the Kafka message is" en: "Defines how the key from the Kafka message is"
" dealt with before being forwarded via MQTT.\n" " dealt with before being forwarded via MQTT.\n"
"<code>none</code> Uses the key or value from the Kafka message unchanged." "<code>none</code> Uses the key from the Kafka message unchanged."
" Note: in this case, then the key or value must be a valid UTF-8 string.\n" " Note: in this case, then the key must be a valid UTF-8 string.\n"
"<code>base64</code> Uses base-64 encoding on the received key or value." "<code>base64</code> Uses base-64 encoding on the received key."
zh: "定义了在通过MQTT转发之前如何处理Kafka消息的键或值。" zh: "定义了在通过MQTT转发之前如何处理Kafka消息的键或值。"
"<code>none</code> 使用Kafka消息中的键或值不改变。" "<code>none</code> 使用Kafka消息中的键或值不改变。"
" 注意在这种情况下那么键或值必须是一个有效的UTF-8字符串。\n" " 注意在这种情况下那么键或值必须是一个有效的UTF-8字符串。\n"
"<code>base64</code> 对收到的密钥或值使用base-64编码。" "<code>base64</code> 对收到的密钥或值使用base-64编码。"
} }
label { label {
en: "Encoding Mode" en: "Key Encoding Mode"
zh: "编码模式"
}
}
consumer_value_encoding_mode {
desc {
en: "Defines how the value from the Kafka message is"
" dealt with before being forwarded via MQTT.\n"
"<code>none</code> Uses the value from the Kafka message unchanged."
" Note: in this case, then the value must be a valid UTF-8 string.\n"
"<code>base64</code> Uses base-64 encoding on the received value."
zh: "定义了在通过MQTT转发之前如何处理Kafka消息的键或值。"
"<code>none</code> 使用Kafka消息中的键或值不改变。"
" 注意在这种情况下那么键或值必须是一个有效的UTF-8字符串。\n"
"<code>base64</code> 对收到的密钥或值使用base-64编码。"
}
label {
en: "Value Encoding Mode"
zh: "编码模式" zh: "编码模式"
} }
} }

View File

@ -338,11 +338,11 @@ fields(consumer_opts) ->
)}, )},
{key_encoding_mode, {key_encoding_mode,
mk(enum([none, base64]), #{ mk(enum([none, base64]), #{
default => none, desc => ?DESC(consumer_encoding_mode) default => none, desc => ?DESC(consumer_key_encoding_mode)
})}, })},
{value_encoding_mode, {value_encoding_mode,
mk(enum([none, base64]), #{ mk(enum([none, base64]), #{
default => none, desc => ?DESC(consumer_encoding_mode) default => none, desc => ?DESC(consumer_value_encoding_mode)
})} })}
]; ];
fields(consumer_topic_mapping) -> fields(consumer_topic_mapping) ->