fix(bridge-mqtt): add max_inflight_size option back

For compatibility with versions below 4.2, we still
use the `max_inflight_size` option, but generate it
as the `max_inflight`

Previous PR: https://github.com/emqx/emqx/pull/3938
This commit is contained in:
JianBo He 2021-01-28 09:29:38 +08:00 committed by JianBo He
parent 9d465ac81f
commit d98d26942c
4 changed files with 7 additions and 5 deletions

View File

@ -55,7 +55,7 @@ translate_env(EnvName) ->
URL = proplists:get_value(url, Req), URL = proplists:get_value(url, Req),
#{host := Host0, #{host := Host0,
path := Path0, path := Path0,
scheme := Scheme} = URIMap = uri_string:parse(add_default_scheme(uri_string:normalize(URL))), scheme := Scheme} = URIMap = uri_string:parse(add_default_scheme(uri_string:normalize(URL))),
Port = maps:get(port, URIMap, case Scheme of Port = maps:get(port, URIMap, case Scheme of
"https" -> 443; "https" -> 443;
"http" -> 80 "http" -> 80

View File

@ -152,7 +152,7 @@ bridge.mqtt.aws.batch_size = 32
## 0 means infinity (no limit on the inflight window) ## 0 means infinity (no limit on the inflight window)
## ##
## Value: Integer ## Value: Integer
bridge.mqtt.aws.max_inflight = 32 bridge.mqtt.aws.max_inflight_size = 32
## Base directory for replayq to store messages on disk ## Base directory for replayq to store messages on disk
## If this config entry is missing or set to undefined, ## If this config entry is missing or set to undefined,

View File

@ -103,7 +103,7 @@
{datatype, {duration, s}} {datatype, {duration, s}}
]}. ]}.
{mapping, "bridge.mqtt.$name.max_inflight", "emqx_bridge_mqtt.bridges", [ {mapping, "bridge.mqtt.$name.max_inflight_size", "emqx_bridge_mqtt.bridges", [
{default, 0}, {default, 0},
{datatype, integer} {datatype, integer}
]}. ]}.
@ -222,6 +222,8 @@
mqttv5 -> v5; mqttv5 -> v5;
_ -> v4 _ -> v4
end}; end};
Tr(max_inflight_size, Size, Cfg) ->
Cfg#{max_inflight => Size};
Tr(Key, Value, Cfg) -> Tr(Key, Value, Cfg) ->
Cfg#{Key => Value} Cfg#{Key => Value}
end, end,

View File

@ -132,8 +132,8 @@
%% and work as message batch transport layer %% and work as message batch transport layer
%% reconnect_delay_ms: Delay in milli-seconds for the bridge worker to retry %% reconnect_delay_ms: Delay in milli-seconds for the bridge worker to retry
%% in case of transportation failure. %% in case of transportation failure.
%% max_inflight_batches: Max number of batches allowed to send-ahead before %% max_inflight: Max number of batches allowed to send-ahead before receiving
%% receiving confirmation from remote node/cluster %% confirmation from remote node/cluster
%% mountpoint: The topic mount point for messages sent to remote node/cluster %% mountpoint: The topic mount point for messages sent to remote node/cluster
%% `undefined', `<<>>' or `""' to disable %% `undefined', `<<>>' or `""' to disable
%% forwards: Local topics to subscribe. %% forwards: Local topics to subscribe.