diff --git a/CHANGELOG.md b/CHANGELOG.md index dc000b780..aca2274ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Change: fix emqtt_pubsub.erl to match '#', '+' Tests: emqtt_topic_tests.erl add more test cases + v0.3.0-alpha (2015-01-18) ------------------------ diff --git a/README.md b/README.md index da05c6da2..3660bc313 100644 --- a/README.md +++ b/README.md @@ -97,26 +97,6 @@ on 'host2': Run './bin/emqtt_ctl cluster' on 'host1' or 'host2' to check cluster nodes. -## Cluster - -Suppose we cluster two nodes on 'host1', 'host2', steps: - -on 'host1': - -``` -./bin/emqtt start -``` - -on 'host2': - -``` -./bin/emqtt start - -./bin/emqtt cluster emqtt@host1 -``` - -Run './bin/emqtt cluster' on 'host1' or 'host2' to check cluster nodes. - ## HTTP API eMQTT support http to publish message. diff --git a/apps/emqtt/include/emqtt_topic.hrl b/apps/emqtt/include/emqtt_topic.hrl index 5bd171d37..cb1b019b7 100644 --- a/apps/emqtt/include/emqtt_topic.hrl +++ b/apps/emqtt/include/emqtt_topic.hrl @@ -39,7 +39,8 @@ -record(topic_trie_node, { node_id :: binary() | atom(), edge_count = 0 :: non_neg_integer(), - topic :: binary() + topic :: binary(), + type = dynamic :: dynamic | static }). -record(topic_trie_edge, { diff --git a/apps/emqtt/src/emqtt_bridge_sup.erl b/apps/emqtt/src/emqtt_bridge_sup.erl new file mode 100644 index 000000000..00efb3c2e --- /dev/null +++ b/apps/emqtt/src/emqtt_bridge_sup.erl @@ -0,0 +1,51 @@ +%%----------------------------------------------------------------------------- +%% Copyright (c) 2012-2015, Feng Lee +%% +%% Permission is hereby granted, free of charge, to any person obtaining a copy +%% of this software and associated documentation files (the "Software"), to deal +%% in the Software without restriction, including without limitation the rights +%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +%% copies of the Software, and to permit persons to whom the Software is +%% furnished to do so, subject to the following conditions: +%% +%% The above copyright notice and this permission notice shall be included in all +%% copies or substantial portions of the Software. +%% +%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +%% SOFTWARE. +%%------------------------------------------------------------------------------ + +-module(emqtt_bridge_sup). + +-author('feng@emqtt.io'). + +-behavior(supervisor). + +-export([start_link/0, start_bridge/2, stop_bridge/1, init/1]). + +start_link() -> + supervisor:start_link({local, ?MODULE}, ?MODULE, []). + +%%TODO: FIXME LATER. +start_bridge(Name, Opts) when is_atom(Name) -> + supervisor:start_child(?MODULE, {{bridge, Name}, + {eqmtt_bridge, start_link, [Opts]}, + transient, 16#fffff, worker, [emqtt_bridge]}). + +stop_bridge(Name) -> + ChildId = {bridge, Name}, + case supervisor:terminate_child(?MODULE, ChildId) of + ok -> + supervisor:delete_child(?MODULE, ChildId); + {error, Reason} -> + {error, Reason} + end. + +init([]) -> + {ok, {{one_for_one, 10, 1000}, []}}. + diff --git a/doc/broker.md b/doc/broker.md new file mode 100644 index 000000000..08337cfdd --- /dev/null +++ b/doc/broker.md @@ -0,0 +1,34 @@ +# Broker Topics + +## Version + +$SYS/broker/version + +## Uptime + +$SYS/broker/uptime + +## Recevied and Sent + +$SYS/broker/bytes/received +$SYS/broker/bytes/sent + +$SYS/broker/packets/received +$SYS/broker/packets/sent + +$SYS/broker/messages/received +$SYS/broker/messages/sent +$SYS/broker/messages/retained +$SYS/broker/messages/stored +$SYS/broker/messages/dropped + +## Client Presence + +$SYS/broker/clients/connected +$SYS/broker/clients/disconnected + +$SYS/broker/clients/${clientId}/presences/online +$SYS/broker/clients/${clientId}presences/offline + + + diff --git a/rel/files/app.config b/rel/files/app.config index f6ae0f077..f1af6ad77 100644 --- a/rel/files/app.config +++ b/rel/files/app.config @@ -32,7 +32,9 @@ ]} ]}, {emqtt, [ - {auth, {anonymous, []}}, %internal, anonymous + %Authetication. Internal, Anonymous Default. + {auth, {anonymous, []}}, + {access, []}, {session, [ {expires, 1}, {max_queue, 1000},