route
This commit is contained in:
parent
89a978a67a
commit
8f22b0ffbc
|
@ -225,7 +225,10 @@ publish(Msg = #mqtt_message{from = From}) ->
|
||||||
|
|
||||||
publish(Topic, Msg) when is_binary(Topic) ->
|
publish(Topic, Msg) when is_binary(Topic) ->
|
||||||
lists:foreach(fun(#mqtt_topic{topic = Name, node = Node}) ->
|
lists:foreach(fun(#mqtt_topic{topic = Name, node = Node}) ->
|
||||||
rpc:cast(Node, ?ROUTER, route, [Name, Msg])
|
case Node =:= node() of
|
||||||
|
true -> ?ROUTER:route(Name, Msg);
|
||||||
|
false -> rpc:cast(Node, ?ROUTER, route, [Name, Msg])
|
||||||
|
end
|
||||||
end, match(Topic)).
|
end, match(Topic)).
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue