diff --git a/apps/emqx_connector/i18n/emqx_connector_mongo.conf b/apps/emqx_connector/i18n/emqx_connector_mongo.conf index e43f7bc33..919ace891 100644 --- a/apps/emqx_connector/i18n/emqx_connector_mongo.conf +++ b/apps/emqx_connector/i18n/emqx_connector_mongo.conf @@ -106,15 +106,103 @@ The MongoDB default port 27017 is used if `[:Port]` is not specified. } } - duration { - desc { - en: "Time interval, such as timeout or TTL." - zh: "时间间隔,例如超时或 TTL。" - } - label: { - en: "Time Interval" - zh: "时间间隔" - } + overflow_ttl { + desc { + en: "Period of time before workers that exceed the configured pool size (\"overflow\") to be terminated." + zh: "超过配置的池子大小(\"溢出\")的工人被终止前的时间段。" + } + label { + en: "Overflow TTL" + zh: "溢出TTL" + } + } + + overflow_check_period { + desc { + en: "Period for checking if there are more workers than configured (\"overflow\")." + zh: "检查是否有超过配置的工人的周期(\"溢出\")。" + } + label { + en: "Overflow Check Period" + zh: "溢出检查期" + } + } + + local_threshold { + desc { + en: "The size of the latency window for selecting among multiple suitable MongoDB instances." + zh: "在多个合适的MongoDB实例中进行选择的延迟窗口的大小。" + } + label { + en: "Local Threshold" + zh: "本地阈值" + } + } + + connect_timeout { + desc { + en: "The duration to attempt a connection before timing out." + zh: "在超时前尝试连接的持续时间。" + } + label { + en: "Connect Timeout" + zh: "连接超时" + } + } + + socket_timeout { + desc { + en: "The duration to attempt to send or to receive on a socket before the attempt times out." + zh: "在尝试超时之前,在套接字上尝试发送或接收的持续时间。" + } + label { + en: "Socket Timeout" + zh: "插座超时" + } + } + + server_selection_timeout { + desc { + en: "Specifies how long to block for server selection before throwing an exception." + zh: "指定在抛出异常之前为服务器选择阻断多长时间。" + } + label { + en: "Server Selection Timeout" + zh: "服务器选择超时" + } + } + + wait_queue_timeout { + desc { + en: "The maximum duration that a worker can wait for a connection to become available." + zh: "工作者等待连接可用的最长时间。" + } + label { + en: "Wait Queue Timeout" + zh: "等待队列超时" + } + } + + heartbeat_period { + desc { + en: "Controls when the driver checks the state of the MongoDB deployment. Specify the interval between checks, counted from the end of the previous check until the beginning of the next one." + zh: "控制驱动程序何时检查MongoDB部署的状态。指定检查的间隔时间,从上一次检查结束到下一次检查开始计算。" + } + label { + en: "Heartbeat period" + zh: "心跳期" + } + } + + min_heartbeat_period { + desc { + en: "Controls the minimum amount of time to wait between heartbeats." + zh: "控制心跳之间的最小等待时间。" + } + label { + en: "Minimum Heartbeat Period" + zh: "最小心跳周期" + } } max_overflow { diff --git a/apps/emqx_connector/src/emqx_connector_mongo.erl b/apps/emqx_connector/src/emqx_connector_mongo.erl index 407fa39a8..f9e703d20 100644 --- a/apps/emqx_connector/src/emqx_connector_mongo.erl +++ b/apps/emqx_connector/src/emqx_connector_mongo.erl @@ -102,15 +102,15 @@ fields(topology) -> [ {pool_size, fun emqx_connector_schema_lib:pool_size/1}, {max_overflow, fun max_overflow/1}, - {overflow_ttl, fun duration/1}, - {overflow_check_period, fun duration/1}, - {local_threshold_ms, fun duration/1}, - {connect_timeout_ms, fun duration/1}, - {socket_timeout_ms, fun duration/1}, - {server_selection_timeout_ms, fun duration/1}, - {wait_queue_timeout_ms, fun duration/1}, - {heartbeat_frequency_ms, fun duration/1}, - {min_heartbeat_frequency_ms, fun duration/1} + {overflow_ttl, duration("overflow_ttl")}, + {overflow_check_period, duration("overflow_check_period")}, + {local_threshold_ms, duration("local_threshold")}, + {connect_timeout_ms, duration("connect_timeout")}, + {socket_timeout_ms, duration("socket_timeout")}, + {server_selection_timeout_ms, duration("server_selection_timeout")}, + {wait_queue_timeout_ms, duration("wait_queue_timeout")}, + {heartbeat_frequency_ms, duration("heartbeat_period")}, + {min_heartbeat_frequency_ms, duration("min_heartbeat_period")} ]. desc(single) -> @@ -403,10 +403,12 @@ r_mode(desc) -> ?DESC("r_mode"); r_mode(default) -> master; r_mode(_) -> undefined. -duration(type) -> emqx_schema:duration_ms(); -duration(desc) -> ?DESC("duration"); -duration(required) -> false; -duration(_) -> undefined. +duration(Desc) -> + #{ + type => emqx_schema:duration_ms(), + required => false, + desc => ?DESC(Desc) + }. max_overflow(type) -> non_neg_integer(); max_overflow(desc) -> ?DESC("max_overflow");