retained messages

This commit is contained in:
Feng Lee 2015-01-18 11:36:21 +08:00
parent c803ce0d7a
commit f16d56c8b9
1 changed files with 2 additions and 0 deletions

View File

@ -71,7 +71,9 @@ retain(Msg = #mqtt_message{retain = true}) ->
%%
subscribe(Topics, CPid) when is_pid(CPid) ->
lager:info("Retained Topics: ~p", [match(Topics)]),
RetainedMsgs = lists:flatten([mnesia:dirty_read(?RETAINED_TAB, Topic) || Topic <- match(Topics)]),
lager:info("Retained Messages: ~p", [RetainedMsgs]),
lists:foreach(fun(Msg) ->
CPid ! {dispatch, {self(), retained_msg(Msg)}}
end, RetainedMsgs).