fix: format the code to remove extra spaces
This commit is contained in:
parent
e6997dc1ce
commit
8207090419
|
@ -46,7 +46,7 @@
|
|||
-define(SYSTOP, <<"$SYS/">>).
|
||||
|
||||
%% Queue topic
|
||||
-define(QUEUE, <<"$queue/">>).
|
||||
-define(QUEUE, <<"$queue/">>).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% alarms
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
-define(OVERLOAD_MIN_ALLOC, 0.3). %% minimum coefficient for overloaded limiter
|
||||
|
||||
-export_type([index/0]).
|
||||
-import(emqx_limiter_decimal, [add/2, sub/2, mul/2, put_to_counter/3]).
|
||||
-import(emqx_limiter_decimal, [add/2, sub/2, mul/2, put_to_counter/3]).
|
||||
|
||||
-elvis([{elvis_style, no_if_expression, disable}]).
|
||||
|
||||
|
|
|
@ -177,7 +177,7 @@ info(packet_id, #mqtt_packet_puback{packet_id = PacketId}) ->
|
|||
PacketId;
|
||||
info(reason_code, #mqtt_packet_puback{reason_code = RC}) ->
|
||||
RC;
|
||||
info(properties, #mqtt_packet_puback{properties = Props}) ->
|
||||
info(properties, #mqtt_packet_puback{properties = Props}) ->
|
||||
Props;
|
||||
|
||||
info(packet_id, #mqtt_packet_subscribe{packet_id = PacketId}) ->
|
||||
|
|
|
@ -78,7 +78,7 @@ is_queue({queue, R, F, L}) when is_list(R), is_list(F), is_integer(L) ->
|
|||
true;
|
||||
is_queue({pqueue, Queues}) when is_list(Queues) ->
|
||||
lists:all(fun ({infinity, Q}) -> is_queue(Q);
|
||||
({P, Q}) -> is_integer(P) andalso is_queue(Q)
|
||||
({P, Q}) -> is_integer(P) andalso is_queue(Q)
|
||||
end, Queues);
|
||||
is_queue(_) ->
|
||||
false.
|
||||
|
@ -268,9 +268,9 @@ highest({queue, [], [], 0}) -> empty;
|
|||
highest({queue, _, _, _}) -> 0;
|
||||
highest({pqueue, [{P, _} | _]}) -> maybe_negate_priority(P).
|
||||
|
||||
r2f([], 0) -> {queue, [], [], 0};
|
||||
r2f([], 0) -> {queue, [], [], 0};
|
||||
r2f([_] = R, 1) -> {queue, [], R, 1};
|
||||
r2f([X,Y], 2) -> {queue, [X], [Y], 2};
|
||||
r2f([X,Y], 2) -> {queue, [X], [Y], 2};
|
||||
r2f([X,Y|R], L) -> {queue, [X,Y], lists:reverse(R, []), L}.
|
||||
|
||||
maybe_negate_priority(infinity) -> infinity;
|
||||
|
|
|
@ -697,7 +697,7 @@ resume(ClientInfo = #{clientid := ClientId}, Session = #session{subscriptions =
|
|||
|
||||
-spec(replay(emqx_types:clientinfo(), session()) -> {ok, replies(), session()}).
|
||||
replay(ClientInfo, Session = #session{inflight = Inflight}) ->
|
||||
Pubs = lists:map(fun({PacketId, {Pubrel, _Ts}}) when is_record(Pubrel, pubrel_await) ->
|
||||
Pubs = lists:map(fun({PacketId, {Pubrel, _Ts}}) when is_record(Pubrel, pubrel_await) ->
|
||||
{pubrel, PacketId};
|
||||
({PacketId, {Msg, _Ts}}) ->
|
||||
{PacketId, emqx_message:set_flag(dup, true, Msg)}
|
||||
|
|
|
@ -110,9 +110,9 @@ sys_heatbeat_interval() ->
|
|||
%% @doc Get sys info
|
||||
-spec(info() -> list(tuple())).
|
||||
info() ->
|
||||
[{version, version()},
|
||||
[{version, version()},
|
||||
{sysdescr, sysdescr()},
|
||||
{uptime, uptime()},
|
||||
{uptime, uptime()},
|
||||
{datetime, datetime()}].
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
|
|
|
@ -166,8 +166,8 @@ schedulers() ->
|
|||
erlang:system_info(schedulers).
|
||||
|
||||
loads() ->
|
||||
[{load1, ftos(avg1()/256)},
|
||||
{load5, ftos(avg5()/256)},
|
||||
[{load1, ftos(avg1()/256)},
|
||||
{load5, ftos(avg5()/256)},
|
||||
{load15, ftos(avg15()/256)}
|
||||
].
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ roots() -> [?CONF_NS].
|
|||
fields(?CONF_NS) ->
|
||||
[ {mechanism, emqx_authn_schema:mechanism('scram')}
|
||||
, {backend, emqx_authn_schema:backend('built-in-database')}
|
||||
, {algorithm, fun algorithm/1}
|
||||
, {algorithm, fun algorithm/1}
|
||||
, {iteration_count, fun iteration_count/1}
|
||||
] ++ emqx_authn_schema:common_fields().
|
||||
|
||||
|
|
|
@ -50,22 +50,20 @@ roots() ->
|
|||
].
|
||||
|
||||
fields(get) ->
|
||||
[ {method, #{type => get,
|
||||
default => post}}
|
||||
, {headers, fun headers_no_content_type/1}
|
||||
[ {method, #{type => get, default => post}}
|
||||
, {headers, fun headers_no_content_type/1}
|
||||
] ++ common_fields();
|
||||
|
||||
fields(post) ->
|
||||
[ {method, #{type => post,
|
||||
default => post}}
|
||||
, {headers, fun headers/1}
|
||||
[ {method, #{type => post, default => post}}
|
||||
, {headers, fun headers/1}
|
||||
] ++ common_fields().
|
||||
|
||||
common_fields() ->
|
||||
[ {mechanism, emqx_authn_schema:mechanism('password-based')}
|
||||
, {backend, emqx_authn_schema:backend(http)}
|
||||
, {url, fun url/1}
|
||||
, {body, fun body/1}
|
||||
, {url, fun url/1}
|
||||
, {body, fun body/1}
|
||||
, {request_timeout, fun request_timeout/1}
|
||||
] ++ emqx_authn_schema:common_fields()
|
||||
++ maps:to_list(maps:without([ base_url
|
||||
|
|
|
@ -48,35 +48,34 @@ roots() ->
|
|||
].
|
||||
|
||||
fields('hmac-based') ->
|
||||
[ {use_jwks, {enum, [false]}}
|
||||
, {algorithm, {enum, ['hmac-based']}}
|
||||
, {secret, fun secret/1}
|
||||
[ {use_jwks, {enum, [false]}}
|
||||
, {algorithm, {enum, ['hmac-based']}}
|
||||
, {secret, fun secret/1}
|
||||
, {secret_base64_encoded, fun secret_base64_encoded/1}
|
||||
] ++ common_fields();
|
||||
|
||||
fields('public-key') ->
|
||||
[ {use_jwks, {enum, [false]}}
|
||||
, {algorithm, {enum, ['public-key']}}
|
||||
, {certificate, fun certificate/1}
|
||||
[ {use_jwks, {enum, [false]}}
|
||||
, {algorithm, {enum, ['public-key']}}
|
||||
, {certificate, fun certificate/1}
|
||||
] ++ common_fields();
|
||||
|
||||
fields('jwks') ->
|
||||
[ {use_jwks, {enum, [true]}}
|
||||
, {endpoint, fun endpoint/1}
|
||||
, {refresh_interval, fun refresh_interval/1}
|
||||
, {ssl, #{type => hoconsc:union(
|
||||
[ hoconsc:ref(?MODULE, ssl_enable)
|
||||
, hoconsc:ref(?MODULE, ssl_disable)
|
||||
]),
|
||||
default => #{<<"enable">> => false}}}
|
||||
[ {use_jwks, {enum, [true]}}
|
||||
, {endpoint, fun endpoint/1}
|
||||
, {refresh_interval, fun refresh_interval/1}
|
||||
, {ssl, #{type => hoconsc:union([ hoconsc:ref(?MODULE, ssl_enable)
|
||||
, hoconsc:ref(?MODULE, ssl_disable)
|
||||
]),
|
||||
default => #{<<"enable">> => false}}}
|
||||
] ++ common_fields();
|
||||
|
||||
fields(ssl_enable) ->
|
||||
[ {enable, #{type => true}}
|
||||
, {cacertfile, fun cacertfile/1}
|
||||
, {certfile, fun certfile/1}
|
||||
, {keyfile, fun keyfile/1}
|
||||
, {verify, fun verify/1}
|
||||
[ {enable, #{type => true}}
|
||||
, {cacertfile, fun cacertfile/1}
|
||||
, {certfile, fun certfile/1}
|
||||
, {keyfile, fun keyfile/1}
|
||||
, {verify, fun verify/1}
|
||||
, {server_name_indication, fun server_name_indication/1}
|
||||
];
|
||||
|
||||
|
@ -85,7 +84,7 @@ fields(ssl_disable) ->
|
|||
|
||||
common_fields() ->
|
||||
[ {mechanism, emqx_authn_schema:mechanism('jwt')}
|
||||
, {verify_claims, fun verify_claims/1}
|
||||
, {verify_claims, fun verify_claims/1}
|
||||
] ++ emqx_authn_schema:common_fields().
|
||||
|
||||
secret(type) -> binary();
|
||||
|
|
|
@ -90,7 +90,7 @@ roots() -> [?CONF_NS].
|
|||
fields(?CONF_NS) ->
|
||||
[ {mechanism, emqx_authn_schema:mechanism('password-based')}
|
||||
, {backend, emqx_authn_schema:backend('built-in-database')}
|
||||
, {user_id_type, fun user_id_type/1}
|
||||
, {user_id_type, fun user_id_type/1}
|
||||
, {password_hash_algorithm, fun emqx_authn_password_hashing:type_rw/1}
|
||||
] ++ emqx_authn_schema:common_fields().
|
||||
|
||||
|
|
|
@ -58,11 +58,11 @@ fields('sharded-cluster') ->
|
|||
common_fields() ->
|
||||
[ {mechanism, emqx_authn_schema:mechanism('password-based')}
|
||||
, {backend, emqx_authn_schema:backend(mongodb)}
|
||||
, {collection, fun collection/1}
|
||||
, {selector, fun selector/1}
|
||||
, {password_hash_field, fun password_hash_field/1}
|
||||
, {salt_field, fun salt_field/1}
|
||||
, {is_superuser_field, fun is_superuser_field/1}
|
||||
, {collection, fun collection/1}
|
||||
, {selector, fun selector/1}
|
||||
, {password_hash_field, fun password_hash_field/1}
|
||||
, {salt_field, fun salt_field/1}
|
||||
, {is_superuser_field, fun is_superuser_field/1}
|
||||
, {password_hash_algorithm, fun emqx_authn_password_hashing:type_ro/1}
|
||||
] ++ emqx_authn_schema:common_fields().
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ fields(?CONF_NS) ->
|
|||
[ {mechanism, emqx_authn_schema:mechanism('password-based')}
|
||||
, {backend, emqx_authn_schema:backend(mysql)}
|
||||
, {password_hash_algorithm, fun emqx_authn_password_hashing:type_ro/1}
|
||||
, {query, fun query/1}
|
||||
, {query_timeout, fun query_timeout/1}
|
||||
, {query, fun query/1}
|
||||
, {query_timeout, fun query_timeout/1}
|
||||
] ++ emqx_authn_schema:common_fields()
|
||||
++ emqx_connector_schema_lib:relational_db_fields()
|
||||
++ emqx_connector_schema_lib:ssl_fields().
|
||||
|
|
|
@ -53,7 +53,7 @@ fields(?CONF_NS) ->
|
|||
[ {mechanism, emqx_authn_schema:mechanism('password-based')}
|
||||
, {backend, emqx_authn_schema:backend(postgresql)}
|
||||
, {password_hash_algorithm, fun emqx_authn_password_hashing:type_ro/1}
|
||||
, {query, fun query/1}
|
||||
, {query, fun query/1}
|
||||
] ++ emqx_authn_schema:common_fields()
|
||||
++ emqx_connector_schema_lib:relational_db_fields()
|
||||
++ emqx_connector_schema_lib:ssl_fields().
|
||||
|
|
|
@ -58,7 +58,7 @@ fields(sentinel) ->
|
|||
common_fields() ->
|
||||
[ {mechanism, emqx_authn_schema:mechanism('password-based')}
|
||||
, {backend, emqx_authn_schema:backend(redis)}
|
||||
, {cmd, fun cmd/1}
|
||||
, {cmd, fun cmd/1}
|
||||
, {password_hash_algorithm, fun emqx_authn_password_hashing:type_ro/1}
|
||||
] ++ emqx_authn_schema:common_fields().
|
||||
|
||||
|
|
|
@ -222,24 +222,36 @@ schema("/authorization/sources/built-in-database/purge-all") ->
|
|||
}.
|
||||
|
||||
fields(rule_item) ->
|
||||
[ {topic, hoconsc:mk( string()
|
||||
, #{ required => true
|
||||
, desc => <<"Rule on specific topic">>
|
||||
, example => <<"test/topic/1">>})}
|
||||
, {permission, hoconsc:mk( hoconsc:enum([allow, deny])
|
||||
, #{desc => <<"Permission">>, required => true, example => allow})}
|
||||
, {action, hoconsc:mk( hoconsc:enum([publish, subscribe, all])
|
||||
, #{ required => true, example => publish
|
||||
, desc => <<"Authorized action">> })} ];
|
||||
[ {topic, hoconsc:mk(string(),
|
||||
#{ required => true
|
||||
, desc => <<"Rule on specific topic">>
|
||||
, example => <<"test/topic/1">>
|
||||
})}
|
||||
, {permission, hoconsc:mk(hoconsc:enum([allow, deny]),
|
||||
#{ desc => <<"Permission">>
|
||||
, required => true
|
||||
, example => allow
|
||||
})}
|
||||
, {action, hoconsc:mk(hoconsc:enum([publish, subscribe, all]),
|
||||
#{ required => true
|
||||
, example => publish
|
||||
, desc => <<"Authorized action">>
|
||||
})}
|
||||
];
|
||||
fields(clientid) ->
|
||||
[ {clientid, hoconsc:mk( binary()
|
||||
, #{ in => path, required => true
|
||||
, desc => <<"ClientID">>, example => <<"client1">>})}
|
||||
[ {clientid, hoconsc:mk(binary(),
|
||||
#{ in => path
|
||||
, required => true
|
||||
, desc => <<"ClientID">>
|
||||
, example => <<"client1">>
|
||||
})}
|
||||
];
|
||||
fields(username) ->
|
||||
[ {username, hoconsc:mk( binary()
|
||||
, #{ in => path, required => true
|
||||
, desc => <<"Username">>, example => <<"user1">>})}
|
||||
[ {username, hoconsc:mk(binary(),
|
||||
#{ in => path
|
||||
, required => true
|
||||
, desc => <<"Username">>
|
||||
, example => <<"user1">>})}
|
||||
];
|
||||
fields(rules_for_username) ->
|
||||
[ {rules, hoconsc:mk(hoconsc:array(hoconsc:ref(rule_item)), #{})}
|
||||
|
@ -400,7 +412,7 @@ rules_example({ExampleName, ExampleType}) ->
|
|||
case ExampleName of
|
||||
username -> {<<"Username">>, ?USERNAME_RULES_EXAMPLE};
|
||||
clientid -> {<<"ClientID">>, ?CLIENTID_RULES_EXAMPLE};
|
||||
all -> {<<"All">>, ?ALL_RULES_EXAMPLE}
|
||||
all -> {<<"All">>, ?ALL_RULES_EXAMPLE}
|
||||
end,
|
||||
Value =
|
||||
case ExampleType of
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
, compile/1
|
||||
]).
|
||||
|
||||
-type(ipaddress() :: {ipaddr, esockd_cidr:cidr_string()} |
|
||||
-type(ipaddress() :: {ipaddr, esockd_cidr:cidr_string()} |
|
||||
{ipaddrs, list(esockd_cidr:cidr_string())}).
|
||||
|
||||
-type(username() :: {username, binary()}).
|
||||
|
|
|
@ -106,15 +106,15 @@ and the new rules will override all rules from the old config file.
|
|||
}}
|
||||
];
|
||||
fields(http_get) ->
|
||||
[ {method, #{type => get, default => post}}
|
||||
[ {method, #{type => get, default => post}}
|
||||
, {headers, fun headers_no_content_type/1}
|
||||
] ++ http_common_fields();
|
||||
fields(http_post) ->
|
||||
[ {method, #{type => post, default => post}}
|
||||
[ {method, #{type => post, default => post}}
|
||||
, {headers, fun headers/1}
|
||||
] ++ http_common_fields();
|
||||
fields(mnesia) ->
|
||||
[ {type, #{type => 'built-in-database'}}
|
||||
[ {type, #{type => 'built-in-database'}}
|
||||
, {enable, #{type => boolean(),
|
||||
default => true}}
|
||||
];
|
||||
|
@ -144,11 +144,11 @@ fields(redis_cluster) ->
|
|||
[ {cmd, query()} ].
|
||||
|
||||
http_common_fields() ->
|
||||
[ {type, #{type => http}}
|
||||
, {enable, #{type => boolean(), default => true}}
|
||||
, {url, fun url/1}
|
||||
[ {type, #{type => http}}
|
||||
, {enable, #{type => boolean(), default => true}}
|
||||
, {url, fun url/1}
|
||||
, {request_timeout, mk_duration("request timeout", #{default => "30s"})}
|
||||
, {body, #{type => map(), nullable => true}}
|
||||
, {body, #{type => map(), nullable => true}}
|
||||
] ++ proplists:delete(base_url, emqx_connector_http:fields(config)).
|
||||
|
||||
mongo_common_fields() ->
|
||||
|
|
|
@ -32,20 +32,9 @@
|
|||
start_link() ->
|
||||
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
|
||||
|
||||
%% sup_flags() = #{strategy => strategy(), % optional
|
||||
%% intensity => non_neg_integer(), % optional
|
||||
%% period => pos_integer()} % optional
|
||||
%% child_spec() = #{id => child_id(), % mandatory
|
||||
%% start => mfargs(), % mandatory
|
||||
%% restart => restart(), % optional
|
||||
%% shutdown => shutdown(), % optional
|
||||
%% type => worker(), % optional
|
||||
%% modules => modules()} % optional
|
||||
init([]) ->
|
||||
SupFlags = #{strategy => one_for_all,
|
||||
intensity => 0,
|
||||
period => 1},
|
||||
ChildSpecs = [],
|
||||
{ok, {SupFlags, ChildSpecs}}.
|
||||
|
||||
%% internal functions
|
||||
|
|
|
@ -36,10 +36,10 @@ fields("topic") ->
|
|||
[ {topic, sc(binary(), #{})}
|
||||
, {qos, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2)]),
|
||||
#{default => 0})}
|
||||
, {rh, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2)]),
|
||||
, {rh, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1), typerefl:integer(2)]),
|
||||
#{default => 0})}
|
||||
, {rap, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1)]), #{default => 0})}
|
||||
, {nl, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1)]), #{default => 0})}
|
||||
, {nl, sc(hoconsc:union([typerefl:integer(0), typerefl:integer(1)]), #{default => 0})}
|
||||
].
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
|
|
|
@ -33,7 +33,7 @@ admins(["status"]) -> status();
|
|||
admins(["skip"]) ->
|
||||
status(),
|
||||
Nodes = mria_mnesia:running_nodes(),
|
||||
lists:foreach(fun emqx_cluster_rpc:skip_failed_commit/1, Nodes),
|
||||
lists:foreach(fun emqx_cluster_rpc:skip_failed_commit/1, Nodes),
|
||||
status();
|
||||
|
||||
admins(["skip", Node0]) ->
|
||||
|
@ -70,7 +70,7 @@ admins(["fast_forward", Node0, ToTnxId]) ->
|
|||
admins(_) ->
|
||||
emqx_ctl:usage(
|
||||
[
|
||||
{"cluster_call status", "status"},
|
||||
{"cluster_call status", "status"},
|
||||
{"cluster_call skip [node]", "increase one commit on specific node"},
|
||||
{"cluster_call tnxid <TnxId>", "get detailed about TnxId"},
|
||||
{"cluster_call fast_forward [node] [tnx_id]", "fast forwards to tnx_id" }
|
||||
|
|
|
@ -263,8 +263,8 @@ fields("node") ->
|
|||
})}
|
||||
, {"global_gc_interval",
|
||||
sc(emqx_schema:duration(),
|
||||
#{ mapping => "emqx_machine.global_gc_interval"
|
||||
, default => "15m"
|
||||
#{ mapping => "emqx_machine.global_gc_interval"
|
||||
, default => "15m"
|
||||
})}
|
||||
, {"crash_dump_file",
|
||||
sc(file(),
|
||||
|
@ -386,15 +386,15 @@ fields("cluster_call") ->
|
|||
})}
|
||||
, {"max_history",
|
||||
sc(range(1, 500),
|
||||
#{ desc => "Retain the maximum number of completed transactions (for queries)."
|
||||
, default => 100
|
||||
#{ desc => "Retain the maximum number of completed transactions (for queries)."
|
||||
, default => 100
|
||||
})}
|
||||
, {"cleanup_interval",
|
||||
sc(emqx_schema:duration(),
|
||||
#{ desc =>
|
||||
#{ desc =>
|
||||
"Time interval to clear completed but stale transactions.
|
||||
Ensure that the number of completed transactions is less than the max_history."
|
||||
, default => "5m"
|
||||
, default => "5m"
|
||||
})}
|
||||
];
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ on_gateway_load(_Gateway = #{name := GwName,
|
|||
case start_listeners(
|
||||
Listeners, GwName, Ctx, ModCfg) of
|
||||
{ok, ListenerPids} ->
|
||||
{ok, ListenerPids, #{ctx => Ctx}};
|
||||
{ok, ListenerPids, #{ctx => Ctx}};
|
||||
{error, {Reason, Listener}} ->
|
||||
throw({badconf, #{ key => listeners
|
||||
, vallue => Listener
|
||||
|
|
|
@ -639,7 +639,7 @@ fields(subscription) ->
|
|||
mk(integer(),
|
||||
#{ desc => <<"QoS level, enum: 0, 1, 2">>})}
|
||||
, {nl,
|
||||
mk(integer(), %% FIXME: why not boolean?
|
||||
mk(integer(), %% FIXME: why not boolean?
|
||||
#{ desc => <<"No Local option, enum: 0, 1">>})}
|
||||
, {rap,
|
||||
mk(integer(),
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
-define(RECORD_SIZE(R), (erlang:map_size(R) - 1)).
|
||||
|
||||
%% uplink and downlink topic configuration
|
||||
-define(lwm2m_up_dm_topic, {<<"/v1/up/dm">>, 0}).
|
||||
-define(lwm2m_up_dm_topic, {<<"/v1/up/dm">>, 0}).
|
||||
|
||||
%% steal from emqx_session
|
||||
-define(INFO_KEYS, [id,
|
||||
|
|
|
@ -44,7 +44,7 @@ print_vsn() ->
|
|||
|
||||
|
||||
start_autocluster() ->
|
||||
ekka:callback(stop, fun emqx_machine_boot:stop_apps/0),
|
||||
ekka:callback(stop, fun emqx_machine_boot:stop_apps/0),
|
||||
ekka:callback(start, fun emqx_machine_boot:ensure_apps_started/0),
|
||||
_ = ekka:autocluster(emqx), %% returns 'ok' or a pid or 'any()' as in spec
|
||||
ok.
|
||||
|
|
|
@ -48,9 +48,9 @@ enable() ->
|
|||
register_hook(Rules).
|
||||
|
||||
disable() ->
|
||||
emqx_hooks:del('client.subscribe', {?MODULE, rewrite_subscribe}),
|
||||
emqx_hooks:del('client.subscribe', {?MODULE, rewrite_subscribe}),
|
||||
emqx_hooks:del('client.unsubscribe', {?MODULE, rewrite_unsubscribe}),
|
||||
emqx_hooks:del('message.publish', {?MODULE, rewrite_publish}),
|
||||
emqx_hooks:del('message.publish', {?MODULE, rewrite_publish}),
|
||||
ok.
|
||||
|
||||
list() ->
|
||||
|
@ -63,9 +63,9 @@ update(Rules0) ->
|
|||
register_hook([]) -> disable();
|
||||
register_hook(Rules) ->
|
||||
{PubRules, SubRules, ErrRules} = compile(Rules),
|
||||
emqx_hooks:put('client.subscribe', {?MODULE, rewrite_subscribe, [SubRules]}),
|
||||
emqx_hooks:put('client.subscribe', {?MODULE, rewrite_subscribe, [SubRules]}),
|
||||
emqx_hooks:put('client.unsubscribe', {?MODULE, rewrite_unsubscribe, [SubRules]}),
|
||||
emqx_hooks:put('message.publish', {?MODULE, rewrite_publish, [PubRules]}),
|
||||
emqx_hooks:put('message.publish', {?MODULE, rewrite_publish, [PubRules]}),
|
||||
case ErrRules of
|
||||
[] -> ok;
|
||||
_ ->
|
||||
|
|
|
@ -101,13 +101,13 @@ max_limit() ->
|
|||
?MAX_TOPICS.
|
||||
|
||||
enable() ->
|
||||
emqx_hooks:put('message.publish', {?MODULE, on_message_publish, []}),
|
||||
emqx_hooks:put('message.dropped', {?MODULE, on_message_dropped, []}),
|
||||
emqx_hooks:put('message.publish', {?MODULE, on_message_publish, []}),
|
||||
emqx_hooks:put('message.dropped', {?MODULE, on_message_dropped, []}),
|
||||
emqx_hooks:put('message.delivered', {?MODULE, on_message_delivered, []}).
|
||||
|
||||
disable() ->
|
||||
emqx_hooks:del('message.publish', {?MODULE, on_message_publish}),
|
||||
emqx_hooks:del('message.dropped', {?MODULE, on_message_dropped}),
|
||||
emqx_hooks:del('message.publish', {?MODULE, on_message_publish}),
|
||||
emqx_hooks:del('message.dropped', {?MODULE, on_message_dropped}),
|
||||
emqx_hooks:del('message.delivered', {?MODULE, on_message_delivered}),
|
||||
deregister_all().
|
||||
|
||||
|
|
|
@ -150,55 +150,55 @@ fields(metrics) ->
|
|||
, mk( integer(), #{ desc => <<"Message dropped count">>
|
||||
, example => 0})},
|
||||
{ 'messages.dropped.rate'
|
||||
, mk( number(), #{ desc => <<"Message dropped rate in 5s">>
|
||||
, mk( number(), #{ desc => <<"Message dropped rate in 5s">>
|
||||
, example => 0})},
|
||||
{ 'messages.in.count'
|
||||
, mk( integer(), #{ desc => <<"Message received count">>
|
||||
, example => 0})},
|
||||
{ 'messages.in.rate'
|
||||
, mk( number(), #{ desc => <<"Message received rate in 5s">>
|
||||
, mk( number(), #{ desc => <<"Message received rate in 5s">>
|
||||
, example => 0})},
|
||||
{ 'messages.out.count'
|
||||
, mk( integer(), #{ desc => <<"Message sent count">>
|
||||
, example => 0})},
|
||||
{ 'messages.out.rate'
|
||||
, mk( number(), #{ desc => <<"Message sent rate in 5s">>
|
||||
, mk( number(), #{ desc => <<"Message sent rate in 5s">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos0.in.count'
|
||||
, mk( integer(), #{ desc => <<"Message with QoS 0 received count">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos0.in.rate'
|
||||
, mk( number(), #{ desc => <<"Message with QoS 0 received rate in 5s">>
|
||||
, mk( number(), #{ desc => <<"Message with QoS 0 received rate in 5s">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos0.out.count'
|
||||
, mk( integer(), #{ desc => <<"Message with QoS 0 sent count">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos0.out.rate'
|
||||
, mk( number(), #{ desc => <<"Message with QoS 0 sent rate in 5s">>
|
||||
, mk( number(), #{ desc => <<"Message with QoS 0 sent rate in 5s">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos1.in.count'
|
||||
, mk( integer(), #{ desc => <<"Message with QoS 1 received count">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos1.in.rate'
|
||||
, mk( number(), #{ desc => <<"Message with QoS 1 received rate in 5s">>
|
||||
, mk( number(), #{ desc => <<"Message with QoS 1 received rate in 5s">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos1.out.count'
|
||||
, mk( integer(), #{ desc => <<"Message with QoS 1 sent count">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos1.out.rate'
|
||||
, mk( number(), #{ desc => <<"Message with QoS 1 sent rate in 5s">>
|
||||
, mk( number(), #{ desc => <<"Message with QoS 1 sent rate in 5s">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos2.in.count'
|
||||
, mk( integer(), #{ desc => <<"Message with QoS 2 sent count">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos2.in.rate'
|
||||
, mk( number(), #{ desc => <<"Message with QoS 2 received rate in 5s">>
|
||||
, mk( number(), #{ desc => <<"Message with QoS 2 received rate in 5s">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos2.out.count'
|
||||
, mk( integer(), #{ desc => <<"Message with QoS 2 sent count">>
|
||||
, example => 0})},
|
||||
{ 'messages.qos2.out.rate'
|
||||
, mk( number(), #{ desc => <<"Message with QoS 2 sent rate in 5s">>
|
||||
, mk( number(), #{ desc => <<"Message with QoS 2 sent rate in 5s">>
|
||||
, example => 0})}
|
||||
].
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@ collect_metrics(Name, Metrics) ->
|
|||
emqx_collect(Name, Metrics).
|
||||
|
||||
add_collect_family(Name, Data, Callback, Type) ->
|
||||
Callback(create_schema(Name, <<"">>, Data, Type)).
|
||||
Callback(create_schema(Name, <<"">>, Data, Type)).
|
||||
|
||||
create_schema(Name, Help, Data, Type) ->
|
||||
create_mf(Name, Help, Type, ?MODULE, Data).
|
||||
|
|
|
@ -42,9 +42,9 @@ to which is configurable by the <code>init_file</code> field.
|
|||
}.
|
||||
|
||||
fields() ->
|
||||
[ {enable, fun enable/1}
|
||||
, {init_file, fun init_file/1}
|
||||
, {separator, fun separator/1}
|
||||
[ {enable, fun enable/1}
|
||||
, {init_file, fun init_file/1}
|
||||
, {separator, fun separator/1}
|
||||
, {chunk_size, fun chunk_size/1}
|
||||
].
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ config(get, _) ->
|
|||
config(put, #{body := Body}) ->
|
||||
try
|
||||
{ok, _} = emqx_retainer:update_config(Body),
|
||||
{200, emqx:get_raw_config([retainer])}
|
||||
{200, emqx:get_raw_config([retainer])}
|
||||
catch _:Reason:_ ->
|
||||
{400,
|
||||
#{code => 'UPDATE_FAILED',
|
||||
|
|
|
@ -36,7 +36,7 @@ fields("statsd") ->
|
|||
[ {enable, hoconsc:mk(boolean(), #{default => false, nullable => false})}
|
||||
, {server, fun server/1}
|
||||
, {sample_time_interval, fun duration_ms/1}
|
||||
, {flush_time_interval, fun duration_ms/1}
|
||||
, {flush_time_interval, fun duration_ms/1}
|
||||
].
|
||||
|
||||
server(type) -> emqx_schema:ip_port();
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
+ **Supported architectures**
|
||||
|
||||
`amd64`, `arm64v8`, `arm32v7`, `i386`, `s390x`
|
||||
`amd64`, `arm64v8`, `arm32v7`, `i386`, `s390x`
|
||||
|
||||
|
||||
+ **Supported Docker versions**:
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
[EMQ X MQTT broker](https://emqx.io/products/broker) is a fully open source, highly scalable, highly available distributed MQTT messaging broker for IoT, M2M and Mobile applications that can handle tens of millions of concurrent clients.
|
||||
|
||||
Starting from 3.0 release, *EMQ X* broker fully supports MQTT V5.0 protocol specifications and backward compatible with MQTT V3.1 and V3.1.1, as well as other communication protocols such as MQTT-SN, CoAP, LwM2M, WebSocket and STOMP. The 3.0 release of the *EMQ X* broker can scaled to 10+ million concurrent MQTT connections on one cluster.
|
||||
Starting from 3.0 release, *EMQ X* broker fully supports MQTT V5.0 protocol specifications and backward compatible with MQTT V3.1 and V3.1.1, as well as other communication protocols such as MQTT-SN, CoAP, LwM2M, WebSocket and STOMP. The 3.0 release of the *EMQ X* broker can scaled to 10+ million concurrent MQTT connections on one cluster.
|
||||
|
||||
# How to use this image
|
||||
|
||||
|
|
Loading…
Reference in New Issue