Drop unused config schema

bridge.$name.transport was added before we decided to derive
transport portocol based on the 'address' config.
i.e. when it's a remote erlang node, use gen_rpc
otherwise (must be IP or hostnmae), we should estabilish mqtt connection
This commit is contained in:
spring2maz 2019-02-19 22:43:10 +01:00 committed by Gilbert Wong
parent efc9e34033
commit 086a1d56b9
3 changed files with 9 additions and 10 deletions

View File

@ -1512,11 +1512,6 @@ end}.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Bridges %% Bridges
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
{mapping, "bridge.$name.transport", "emqx.bridges", [
{default, mqtt_client},
{datatype, {enum, [emqx_portal, mqtt_client]}}
]}.
{mapping, "bridge.$name.address", "emqx.bridges", [ {mapping, "bridge.$name.address", "emqx.bridges", [
{datatype, string} {datatype, string}
]}. ]}.

View File

@ -353,8 +353,11 @@ do_ensure_present(forwards, Topic, _) ->
do_ensure_present(subscriptions, {Topic, QoS}, do_ensure_present(subscriptions, {Topic, QoS},
#{connect_module := ConnectModule, connection := Conn}) -> #{connect_module := ConnectModule, connection := Conn}) ->
case erlang:function_exported(ConnectModule, ensure_subscribed, 3) of case erlang:function_exported(ConnectModule, ensure_subscribed, 3) of
true -> ConnectModule:ensure_subscribed(Conn, Topic, QoS); true ->
false -> {error, no_remote_subscription_support} _ = ConnectModule:ensure_subscribed(Conn, Topic, QoS),
ok;
false ->
{error, no_remote_subscription_support}
end. end.
do_ensure_absent(forwards, Topic, _) -> do_ensure_absent(forwards, Topic, _) ->

View File

@ -142,7 +142,10 @@ t_mqtt(Config) when is_list(Config) ->
ClientId = <<"client-1">>, ClientId = <<"client-1">>,
try try
?assertEqual([{ForwardedTopic, 1}], emqx_portal:get_subscriptions(Pid)), ?assertEqual([{ForwardedTopic, 1}], emqx_portal:get_subscriptions(Pid)),
emqx_portal:ensure_subscription_present(Pid, ForwardedTopic2, _QoS = 1), ok = emqx_portal:ensure_subscription_present(Pid, ForwardedTopic2, _QoS = 1),
ok = emqx_portal:ensure_forward_present(Pid, SendToTopic2),
%% TODO: investigate why it's necessary
timer:sleep(1000),
?assertEqual([{ForwardedTopic, 1}, ?assertEqual([{ForwardedTopic, 1},
{ForwardedTopic2, 1}], emqx_portal:get_subscriptions(Pid)), {ForwardedTopic2, 1}], emqx_portal:get_subscriptions(Pid)),
{ok, ConnPid} = emqx_mock_client:start_link(ClientId), {ok, ConnPid} = emqx_mock_client:start_link(ClientId),
@ -155,8 +158,6 @@ t_mqtt(Config) when is_list(Config) ->
emqx_session:publish(SPid, I, Msg) emqx_session:publish(SPid, I, Msg)
end, Msgs), end, Msgs),
ok = receive_and_match_messages(Ref, Msgs), ok = receive_and_match_messages(Ref, Msgs),
ok = emqx_portal:ensure_forward_present(Pid, SendToTopic2),
timer:sleep(200),
Msgs2 = lists:seq(Max + 1, Max * 2), Msgs2 = lists:seq(Max + 1, Max * 2),
lists:foreach(fun(I) -> lists:foreach(fun(I) ->
Msg = emqx_message:make(<<"client-2">>, ?QOS_1, SendToTopic2, integer_to_binary(I)), Msg = emqx_message:make(<<"client-2">>, ?QOS_1, SendToTopic2, integer_to_binary(I)),