diff --git a/apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl b/apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl
index 1a766b975..4498d3d8d 100644
--- a/apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl
+++ b/apps/emqx_authn/src/simple_authn/emqx_authn_mongodb.erl
@@ -60,11 +60,11 @@ roots() ->
].
fields(mongo_single) ->
- common_fields() ++ emqx_connector_mongo:fields(single);
+ common_fields() ++ emqx_mongodb:fields(single);
fields(mongo_rs) ->
- common_fields() ++ emqx_connector_mongo:fields(rs);
+ common_fields() ++ emqx_mongodb:fields(rs);
fields(mongo_sharded) ->
- common_fields() ++ emqx_connector_mongo:fields(sharded).
+ common_fields() ++ emqx_mongodb:fields(sharded).
desc(mongo_single) ->
?DESC(single);
@@ -140,14 +140,14 @@ create(Config0) ->
{Config, State} = parse_config(Config0),
{ok, _Data} = emqx_authn_utils:create_resource(
ResourceId,
- emqx_connector_mongo,
+ emqx_mongodb,
Config
),
{ok, State#{resource_id => ResourceId}}.
update(Config0, #{resource_id := ResourceId} = _State) ->
{Config, NState} = parse_config(Config0),
- case emqx_authn_utils:update_resource(emqx_connector_mongo, Config, ResourceId) of
+ case emqx_authn_utils:update_resource(emqx_mongodb, Config, ResourceId) of
{error, Reason} ->
error({load_config_error, Reason});
{ok, _} ->
diff --git a/apps/emqx_authn/test/emqx_authn_mongo_tls_SUITE.erl b/apps/emqx_authn/test/emqx_authn_mongo_tls_SUITE.erl
index 3725bc051..34f906dd9 100644
--- a/apps/emqx_authn/test/emqx_authn_mongo_tls_SUITE.erl
+++ b/apps/emqx_authn/test/emqx_authn_mongo_tls_SUITE.erl
@@ -64,7 +64,7 @@ end_per_suite(_Config) ->
%% Tests
%%------------------------------------------------------------------------------
-%% emqx_connector_mongo connects asynchronously,
+%% emqx_mongodb connects asynchronously,
%% so we check failure/success indirectly (through snabbkaffe).
%% openssl s_client -tls1_2 -cipher ECDHE-RSA-AES256-GCM-SHA384 \
diff --git a/apps/emqx_authz/src/emqx_authz_api_schema.erl b/apps/emqx_authz/src/emqx_authz_api_schema.erl
index 049c84713..f841fb9b1 100644
--- a/apps/emqx_authz/src/emqx_authz_api_schema.erl
+++ b/apps/emqx_authz/src/emqx_authz_api_schema.erl
@@ -60,13 +60,13 @@ fields(built_in_database) ->
authz_common_fields(built_in_database);
fields(mongo_single) ->
authz_mongo_common_fields() ++
- emqx_connector_mongo:fields(single);
+ emqx_mongodb:fields(single);
fields(mongo_rs) ->
authz_mongo_common_fields() ++
- emqx_connector_mongo:fields(rs);
+ emqx_mongodb:fields(rs);
fields(mongo_sharded) ->
authz_mongo_common_fields() ++
- emqx_connector_mongo:fields(sharded);
+ emqx_mongodb:fields(sharded);
fields(mysql) ->
authz_common_fields(mysql) ++
[{query, query()}] ++
diff --git a/apps/emqx_authz/src/emqx_authz_mongodb.erl b/apps/emqx_authz/src/emqx_authz_mongodb.erl
index 8d04a3229..e82ff64e1 100644
--- a/apps/emqx_authz/src/emqx_authz_mongodb.erl
+++ b/apps/emqx_authz/src/emqx_authz_mongodb.erl
@@ -50,13 +50,13 @@ description() ->
create(#{filter := Filter} = Source) ->
ResourceId = emqx_authz_utils:make_resource_id(?MODULE),
- {ok, _Data} = emqx_authz_utils:create_resource(ResourceId, emqx_connector_mongo, Source),
+ {ok, _Data} = emqx_authz_utils:create_resource(ResourceId, emqx_mongodb, Source),
FilterTemp = emqx_authz_utils:parse_deep(Filter, ?PLACEHOLDERS),
Source#{annotations => #{id => ResourceId}, filter_template => FilterTemp}.
update(#{filter := Filter} = Source) ->
FilterTemp = emqx_authz_utils:parse_deep(Filter, ?PLACEHOLDERS),
- case emqx_authz_utils:update_resource(emqx_connector_mongo, Source) of
+ case emqx_authz_utils:update_resource(emqx_mongodb, Source) of
{error, Reason} ->
error({load_config_error, Reason});
{ok, Id} ->
diff --git a/apps/emqx_authz/src/emqx_authz_schema.erl b/apps/emqx_authz/src/emqx_authz_schema.erl
index b19c62441..18afacb23 100644
--- a/apps/emqx_authz/src/emqx_authz_schema.erl
+++ b/apps/emqx_authz/src/emqx_authz_schema.erl
@@ -109,15 +109,15 @@ fields(builtin_db) ->
fields(mongo_single) ->
authz_common_fields(mongodb) ++
mongo_common_fields() ++
- emqx_connector_mongo:fields(single);
+ emqx_mongodb:fields(single);
fields(mongo_rs) ->
authz_common_fields(mongodb) ++
mongo_common_fields() ++
- emqx_connector_mongo:fields(rs);
+ emqx_mongodb:fields(rs);
fields(mongo_sharded) ->
authz_common_fields(mongodb) ++
mongo_common_fields() ++
- emqx_connector_mongo:fields(sharded);
+ emqx_mongodb:fields(sharded);
fields(mysql) ->
authz_common_fields(mysql) ++
connector_fields(mysql) ++
diff --git a/apps/emqx_bridge_mongodb/src/emqx_bridge_mongodb.erl b/apps/emqx_bridge_mongodb/src/emqx_bridge_mongodb.erl
index 694d13fa7..72485815f 100644
--- a/apps/emqx_bridge_mongodb/src/emqx_bridge_mongodb.erl
+++ b/apps/emqx_bridge_mongodb/src/emqx_bridge_mongodb.erl
@@ -56,11 +56,11 @@ fields("creation_opts") ->
}}
]);
fields(mongodb_rs) ->
- emqx_connector_mongo:fields(rs) ++ fields("config");
+ emqx_mongodb:fields(rs) ++ fields("config");
fields(mongodb_sharded) ->
- emqx_connector_mongo:fields(sharded) ++ fields("config");
+ emqx_mongodb:fields(sharded) ++ fields("config");
fields(mongodb_single) ->
- emqx_connector_mongo:fields(single) ++ fields("config");
+ emqx_mongodb:fields(single) ++ fields("config");
fields("post_rs") ->
fields(mongodb_rs) ++ type_and_name_fields(mongodb_rs);
fields("post_sharded") ->
diff --git a/apps/emqx_bridge_mongodb/src/emqx_bridge_mongodb_connector.erl b/apps/emqx_bridge_mongodb/src/emqx_bridge_mongodb_connector.erl
index b6f7e4939..eb0a22e9c 100644
--- a/apps/emqx_bridge_mongodb/src/emqx_bridge_mongodb_connector.erl
+++ b/apps/emqx_bridge_mongodb/src/emqx_bridge_mongodb_connector.erl
@@ -25,10 +25,10 @@
%% `emqx_resource' API
%%========================================================================================
-callback_mode() -> emqx_connector_mongo:callback_mode().
+callback_mode() -> emqx_mongodb:callback_mode().
on_start(InstanceId, Config) ->
- case emqx_connector_mongo:on_start(InstanceId, Config) of
+ case emqx_mongodb:on_start(InstanceId, Config) of
{ok, ConnectorState} ->
PayloadTemplate0 = maps:get(payload_template, Config, undefined),
PayloadTemplate = preprocess_template(PayloadTemplate0),
@@ -45,7 +45,7 @@ on_start(InstanceId, Config) ->
end.
on_stop(InstanceId, _State = #{connector_state := ConnectorState}) ->
- emqx_connector_mongo:on_stop(InstanceId, ConnectorState).
+ emqx_mongodb:on_stop(InstanceId, ConnectorState).
on_query(InstanceId, {send_message, Message0}, State) ->
#{
@@ -57,14 +57,14 @@ on_query(InstanceId, {send_message, Message0}, State) ->
collection => emqx_placeholder:proc_tmpl(CollectionTemplate, Message0)
},
Message = render_message(PayloadTemplate, Message0),
- Res = emqx_connector_mongo:on_query(InstanceId, {send_message, Message}, NewConnectorState),
+ Res = emqx_mongodb:on_query(InstanceId, {send_message, Message}, NewConnectorState),
?tp(mongo_ee_connector_on_query_return, #{result => Res}),
Res;
on_query(InstanceId, Request, _State = #{connector_state := ConnectorState}) ->
- emqx_connector_mongo:on_query(InstanceId, Request, ConnectorState).
+ emqx_mongodb:on_query(InstanceId, Request, ConnectorState).
on_get_status(InstanceId, _State = #{connector_state := ConnectorState}) ->
- emqx_connector_mongo:on_get_status(InstanceId, ConnectorState).
+ emqx_mongodb:on_get_status(InstanceId, ConnectorState).
%%========================================================================================
%% Helper fns
diff --git a/apps/emqx_mongodb/src/emqx_connector_mongo.erl b/apps/emqx_mongodb/src/emqx_mongodb.erl
similarity index 99%
rename from apps/emqx_mongodb/src/emqx_connector_mongo.erl
rename to apps/emqx_mongodb/src/emqx_mongodb.erl
index f70f4ea76..9daffd43f 100644
--- a/apps/emqx_mongodb/src/emqx_connector_mongo.erl
+++ b/apps/emqx_mongodb/src/emqx_mongodb.erl
@@ -13,7 +13,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%--------------------------------------------------------------------
--module(emqx_connector_mongo).
+-module(emqx_mongodb).
-include_lib("emqx_connector/include/emqx_connector.hrl").
-include_lib("typerefl/include/types.hrl").
diff --git a/apps/emqx_mongodb/test/emqx_connector_mongo_SUITE.erl b/apps/emqx_mongodb/test/emqx_mongodb_SUITE.erl
similarity index 97%
rename from apps/emqx_mongodb/test/emqx_connector_mongo_SUITE.erl
rename to apps/emqx_mongodb/test/emqx_mongodb_SUITE.erl
index 9067c85de..3ee876934 100644
--- a/apps/emqx_mongodb/test/emqx_connector_mongo_SUITE.erl
+++ b/apps/emqx_mongodb/test/emqx_mongodb_SUITE.erl
@@ -13,7 +13,7 @@
% %% limitations under the License.
% %%--------------------------------------------------------------------
--module(emqx_connector_mongo_SUITE).
+-module(emqx_mongodb_SUITE).
-compile(nowarn_export_all).
-compile(export_all).
@@ -24,7 +24,7 @@
-include_lib("stdlib/include/assert.hrl").
-define(MONGO_HOST, "mongo").
--define(MONGO_RESOURCE_MOD, emqx_connector_mongo).
+-define(MONGO_RESOURCE_MOD, emqx_mongodb).
all() ->
emqx_common_test_helpers:all(?MODULE).
@@ -60,7 +60,7 @@ end_per_testcase(_, _Config) ->
t_lifecycle(_Config) ->
perform_lifecycle_check(
- <<"emqx_connector_mongo_SUITE">>,
+ <<"emqx_mongodb_SUITE">>,
mongo_config()
).
diff --git a/apps/emqx_mongodb/test/emqx_connector_mongo_tests.erl b/apps/emqx_mongodb/test/emqx_mongodb_tests.erl
similarity index 97%
rename from apps/emqx_mongodb/test/emqx_connector_mongo_tests.erl
rename to apps/emqx_mongodb/test/emqx_mongodb_tests.erl
index 3cfe52b98..4207998b7 100644
--- a/apps/emqx_mongodb/test/emqx_connector_mongo_tests.erl
+++ b/apps/emqx_mongodb/test/emqx_mongodb_tests.erl
@@ -14,7 +14,7 @@
%% limitations under the License.
%%--------------------------------------------------------------------
--module(emqx_connector_mongo_tests).
+-module(emqx_mongodb_tests).
-include_lib("eunit/include/eunit.hrl").
@@ -84,12 +84,12 @@ bad_query_string_test() ->
).
resolve(Config) ->
- emqx_connector_mongo:maybe_resolve_srv_and_txt_records(Config).
+ emqx_mongodb:maybe_resolve_srv_and_txt_records(Config).
checked_config(Hocon) ->
{ok, Config} = hocon:binary(Hocon),
hocon_tconf:check_plain(
- emqx_connector_mongo,
+ emqx_mongodb,
#{<<"config">> => Config},
#{atom_key => true}
).
diff --git a/rel/i18n/emqx_connector_mongo.hocon b/rel/i18n/emqx_mongodb.hocon
similarity index 99%
rename from rel/i18n/emqx_connector_mongo.hocon
rename to rel/i18n/emqx_mongodb.hocon
index facbab3a3..b1830868d 100644
--- a/rel/i18n/emqx_connector_mongo.hocon
+++ b/rel/i18n/emqx_mongodb.hocon
@@ -1,4 +1,4 @@
-emqx_connector_mongo {
+emqx_mongodb {
auth_source.desc:
"""Database name associated with the user's credentials."""
diff --git a/rel/i18n/zh/emqx_mongodb.hocon b/rel/i18n/zh/emqx_mongodb.hocon
new file mode 100644
index 000000000..2d3c5c16d
--- /dev/null
+++ b/rel/i18n/zh/emqx_mongodb.hocon
@@ -0,0 +1,152 @@
+emqx_mongodb {
+
+auth_source.desc:
+"""与用户证书关联的数据库名称。"""
+
+auth_source.label:
+"""认证源"""
+
+connect_timeout.desc:
+"""超时重连的等待时间。"""
+
+connect_timeout.label:
+"""连接超时"""
+
+desc_rs.desc:
+"""配置 Replica Set"""
+
+desc_rs.label:
+"""配置 Replica Set"""
+
+desc_sharded.desc:
+"""配置 Sharded Cluster"""
+
+desc_sharded.label:
+"""配置 Sharded Cluster"""
+
+desc_single.desc:
+"""配置 Single 模式"""
+
+desc_single.label:
+"""配置 Single 模式"""
+
+desc_topology.desc:
+"""配置 Topology"""
+
+desc_topology.label:
+"""配置 Topology"""
+
+heartbeat_period.desc:
+"""控制驱动程序何时检查MongoDB部署的状态。指定检查的间隔时间,从上一次检查结束到下一次检查开始计算。如果连接数增加(例如,如果你增加池子的大小,就会发生这种情况),你可能也需要增加这个周期,以避免在MongoDB日志文件中创建太多的日志条目。"""
+
+heartbeat_period.label:
+"""心跳期"""
+
+local_threshold.desc:
+"""在多个合适的MongoDB实例中进行选择的延迟窗口的大小。"""
+
+local_threshold.label:
+"""本地阈值"""
+
+max_overflow.desc:
+"""最大溢出。"""
+
+max_overflow.label:
+"""最大溢出"""
+
+min_heartbeat_period.desc:
+"""心跳间的最小间隙"""
+
+min_heartbeat_period.label:
+"""最小心跳周期"""
+
+overflow_check_period.desc:
+"""检查是否有超过配置的工人的周期("溢出")。"""
+
+overflow_check_period.label:
+"""溢出检查周期"""
+
+overflow_ttl.desc:
+"""当池内工人太多时,等待多久清除多余工人。"""
+
+overflow_ttl.label:
+"""溢出TTL"""
+
+r_mode.desc:
+"""读模式。"""
+
+r_mode.label:
+"""读模式"""
+
+replica_set_name.desc:
+"""副本集的名称。"""
+
+replica_set_name.label:
+"""副本集名称"""
+
+rs_mongo_type.desc:
+"""Replica set模式。当 MongoDB 服务运行在 replica-set 模式下,该配置必须设置为 'rs'。"""
+
+rs_mongo_type.label:
+"""Replica set 模式"""
+
+server.desc:
+"""将要连接的 IPv4 或 IPv6 地址,或者主机名。
+主机名具有以下形式:`Host[:Port]`。
+如果未指定 `[:Port]`,则使用 MongoDB 默认端口 27017。"""
+
+server.label:
+"""服务器地址"""
+
+server_selection_timeout.desc:
+"""指定在抛出异常之前为服务器选择阻断多长时间。"""
+
+server_selection_timeout.label:
+"""服务器选择超时"""
+
+servers.desc:
+"""集群将要连接的节点列表。 节点之间用逗号分隔,如:`Node[,Node].`
+每个节点的配置为:将要连接的 IPv4 或 IPv6 地址或主机名。
+主机名具有以下形式:`Host[:Port]`。
+如果未指定 `[:Port]`,则使用 MongoDB 默认端口 27017。"""
+
+servers.label:
+"""服务器列表"""
+
+sharded_mongo_type.desc:
+"""Sharded cluster模式。当 MongoDB 服务运行在 sharded 模式下,该配置必须设置为 'sharded'。"""
+
+sharded_mongo_type.label:
+"""Sharded cluster 模式"""
+
+single_mongo_type.desc:
+"""Standalone 模式。当 MongoDB 服务运行在 standalone 模式下,该配置必须设置为 'single'。"""
+
+single_mongo_type.label:
+"""Standalone 模式"""
+
+socket_timeout.desc:
+"""在尝试超时之前,在套接字上尝试发送或接收的持续时间。"""
+
+socket_timeout.label:
+"""套接字操作超时"""
+
+srv_record.desc:
+"""使用 DNS SRV 记录。"""
+
+srv_record.label:
+"""SRV 记录"""
+
+w_mode.desc:
+"""写模式。"""
+
+w_mode.label:
+"""写模式"""
+
+wait_queue_timeout.desc:
+"""工作者等待连接可用的最长时间。"""
+
+wait_queue_timeout.label:
+"""等待队列超时"""
+
+}