Rename 'message.offline' hook to 'message.dropped'

This commit is contained in:
Feng Lee 2017-10-31 15:19:53 +08:00
parent 2354a3dd5d
commit 49d91cf694
3 changed files with 4 additions and 4 deletions

View File

@ -70,7 +70,7 @@ publish(Topic, Msg) ->
emqx_router:match_local(Topic)), delivery(Msg)).
route([], #mqtt_delivery{message = Msg}) ->
emqx_hooks:run('message.offline', [undefined, Msg]),
emqx_hooks:run('message.dropped', [undefined, Msg]),
dropped(Msg#mqtt_message.topic), ignore;
%% Dispatch on the local node
@ -98,7 +98,7 @@ forward(Node, To, Delivery) ->
dispatch(Topic, Delivery = #mqtt_delivery{message = Msg, flows = Flows}) ->
case subscribers(Topic) of
[] ->
emqx_hooks:run('message.offline', [undefined, Msg]),
emqx_hooks:run('message.dropped', [undefined, Msg]),
dropped(Topic), {ok, Delivery};
[Sub] -> %% optimize?
dispatch(Sub, Topic, Msg),

View File

@ -695,7 +695,7 @@ is_awaiting_full(#state{awaiting_rel = AwaitingRel, max_awaiting_rel = MaxLen})
%% Enqueue message if the client has been disconnected
dispatch(Msg, State = #state{client_id = ClientId, client_pid = undefined}) ->
case emqx_hooks:run('message.offline', [ClientId, Msg]) of
case emqx_hooks:run('message.dropped', [ClientId, Msg]) of
ok -> enqueue_msg(Msg, State);
stop -> State
end;

View File

@ -117,7 +117,7 @@ dispatch(ClientId, Topic, Msg) ->
Pid -> Pid ! {dispatch, Topic, Msg}
catch
error:badarg ->
emqx_hooks:run('message.offline', [ClientId, Msg]),
emqx_hooks:run('message.dropped', [ClientId, Msg]),
ok %%TODO: How??
end.