Change the config of 'zone.$name.publish_limit'
This commit is contained in:
Feng Lee 2018-09-22 16:10:30 +08:00 committed by Feng Lee
parent 8f35d13e17
commit 5689ad3485
2 changed files with 28 additions and 20 deletions

View File

@ -525,20 +525,20 @@ zone.external.idle_timeout = 15s
## Publish limit for the external MQTT connections. ## Publish limit for the external MQTT connections.
## ##
## Value: rate,burst ## Value: Number,Duration
## Default: 10 messages per second, and 100 messages burst. ## Example: 10 messages per minute.
## zone.external.publish_limit = 10,100 zone.external.publish_limit = 10,1m
## Enable ban check.
##
## Value: Flag
zone.external.enable_ban = on
## Enable ACL check. ## Enable ACL check.
## ##
## Value: Flag ## Value: Flag
zone.external.enable_acl = on zone.external.enable_acl = on
## Enable ban check.
##
## Value: Flag
zone.external.enable_ban = on
## Enable per connection statistics. ## Enable per connection statistics.
## ##
## Value: on | off ## Value: on | off
@ -766,7 +766,7 @@ listener.tcp.external.zone = external
## ##
## Value: rate,burst ## Value: rate,burst
## Unit: Bps ## Unit: Bps
## listener.tcp.external.rate_limit = 1024,4096 listener.tcp.external.rate_limit = 1024,4096
## The access control rules for the MQTT/TCP listener. ## The access control rules for the MQTT/TCP listener.
## ##

View File

@ -676,14 +676,14 @@ end}.
{datatype, {enum, [allow, deny]}} {datatype, {enum, [allow, deny]}}
]}. ]}.
%% @doc Enable Ban. %% @doc Enable ACL check.
{mapping, "zone.$name.enable_ban", "emqx.zones", [ {mapping, "zone.$name.enable_acl", "emqx.zones", [
{default, off}, {default, off},
{datatype, flag} {datatype, flag}
]}. ]}.
%% @doc Enable ACL check. %% @doc Enable Ban.
{mapping, "zone.$name.enable_acl", "emqx.zones", [ {mapping, "zone.$name.enable_ban", "emqx.zones", [
{default, off}, {default, off},
{datatype, flag} {datatype, flag}
]}. ]}.
@ -696,7 +696,6 @@ end}.
%% @doc Publish limit of the MQTT connections. %% @doc Publish limit of the MQTT connections.
{mapping, "zone.$name.publish_limit", "emqx.zones", [ {mapping, "zone.$name.publish_limit", "emqx.zones", [
{default, undefined},
{datatype, string} {datatype, string}
]}. ]}.
@ -850,6 +849,15 @@ end}.
{mqtt_wildcard_subscription, Val}; {mqtt_wildcard_subscription, Val};
("shared_subscription", Val) -> ("shared_subscription", Val) ->
{mqtt_shared_subscription, Val}; {mqtt_shared_subscription, Val};
("publish_limit", Val) ->
[Limit, Duration] = string:tokens(Val, ", "),
PubLimit = case cuttlefish_duration:parse(Duration, s) of
Secs when is_integer(Secs) ->
{list_to_integer(Limit) / Secs, list_to_integer(Limit)};
{error, Reason} ->
error(Reason)
end,
{publish_limit, PubLimit};
("force_gc_policy", Val) -> ("force_gc_policy", Val) ->
[Count, Bytes] = string:tokens(Val, "| "), [Count, Bytes] = string:tokens(Val, "| "),
GcPolicy = case cuttlefish_bytesize:parse(Bytes) of GcPolicy = case cuttlefish_bytesize:parse(Bytes) of