fix(will-msg): fix mountpoint not working for will-msg.
This commit is contained in:
parent
966e6ddeeb
commit
fcbf1bc890
|
@ -2134,10 +2134,14 @@ will_delay_interval(WillMsg) ->
|
||||||
0
|
0
|
||||||
).
|
).
|
||||||
|
|
||||||
publish_will_msg(ClientInfo, Msg = #message{topic = Topic}) ->
|
publish_will_msg(
|
||||||
|
ClientInfo = #{mountpoint := MountPoint},
|
||||||
|
Msg = #message{topic = Topic}
|
||||||
|
) ->
|
||||||
case emqx_access_control:authorize(ClientInfo, publish, Topic) of
|
case emqx_access_control:authorize(ClientInfo, publish, Topic) of
|
||||||
allow ->
|
allow ->
|
||||||
_ = emqx_broker:publish(Msg),
|
NMsg = emqx_mountpoint:mount(MountPoint, Msg),
|
||||||
|
_ = emqx_broker:publish(NMsg),
|
||||||
ok;
|
ok;
|
||||||
deny ->
|
deny ->
|
||||||
?tp(
|
?tp(
|
||||||
|
|
|
@ -728,6 +728,22 @@ t_quota_qos2(_) ->
|
||||||
del_bucket(),
|
del_bucket(),
|
||||||
esockd_limiter:stop().
|
esockd_limiter:stop().
|
||||||
|
|
||||||
|
t_mount_will_msg(_) ->
|
||||||
|
Self = self(),
|
||||||
|
ClientInfo = clientinfo(#{mountpoint => <<"prefix/">>}),
|
||||||
|
Msg = emqx_message:make(test, <<"will_topic">>, <<"will_payload">>),
|
||||||
|
Channel = channel(#{clientinfo => ClientInfo, will_msg => Msg}),
|
||||||
|
|
||||||
|
ok = meck:expect(emqx_broker, publish, fun(M) -> Self ! {pub, M} end),
|
||||||
|
|
||||||
|
{shutdown, kicked, ok, ?DISCONNECT_PACKET(?RC_ADMINISTRATIVE_ACTION), _} = emqx_channel:handle_call(
|
||||||
|
kick, Channel
|
||||||
|
),
|
||||||
|
receive
|
||||||
|
{pub, #message{topic = <<"prefix/will_topic">>}} -> ok
|
||||||
|
after 200 -> exit(will_message_not_published_or_not_correct)
|
||||||
|
end.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Test cases for handle_deliver
|
%% Test cases for handle_deliver
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue