EMQX消息存储MongoDB 牵涉的外部库文件列表
1、mongodb:https://github.com/comtihon/mongodb-erlang.git
2、ecpool:ecpool
is different with worker-pool libraries in that it is designed to pool connection/clients to server or database https://github.com/emqx/ecpool.git
-module(emqx_backend_mongo_app).
-include("../include/emqx_backend_mongo.hrl").
-behaviour(application).
-emqx_plugin(backend).
-export([start/2, stop/1]).
start(_Type, _Args) ->
%% 获取池配置
Pools = application:get_env(emqx_backend_mongo, pools, []),
%% 启动application监听者
{ok, Sup} = emqx_backend_mongo_sup:start_link(Pools),
%% 注册统计
emqx_backend_mongo:register_metrics(),
%% 载入钩子
emqx_backend_mongo:load(),
{ok, Sup}.
%% 卸载钩子
stop(_State) -> emqx_backend_mongo:unload().