sync with imac

This commit is contained in:
Feng Lee 2015-04-27 09:14:04 +08:00
parent 6cc7f63c2b
commit eb84783d4a
4 changed files with 28 additions and 9 deletions

View File

@ -32,6 +32,8 @@
-export([match/2, validate/1, triples/1, words/1, wildcard/1]).
-export([systop/1]).
%-type type() :: static | dynamic.
-type word() :: '' | '+' | '#' | binary().
@ -164,3 +166,14 @@ word(<<"+">>) -> '+';
word(<<"#">>) -> '#';
word(Bin) -> Bin.
%%------------------------------------------------------------------------------
%% @doc '$SYS' Topic.
%% @end
%%------------------------------------------------------------------------------
systop(Name) when is_atom(Name) ->
list_to_binary(lists:concat(["$SYS/brokers/", node(), "/", Name]));
systop(Name) when is_binary(Name) ->
list_to_binary(["$SYS/brokers/", atom_to_list(node()), "/", Name]).

View File

@ -122,7 +122,7 @@ init([]) ->
Topics = ?SYSTOP_CLIENTS ++ ?SYSTOP_SESSIONS ++ ?SYSTOP_PUBSUB,
[ets:insert(?STATS_TAB, {Topic, 0}) || Topic <- Topics],
% Create $SYS Topics
[ok = emqttd_pubsub:create(systop(Topic)) || Topic <- Topics],
[ok = emqttd_pubsub:create(emqtt_topic:systop(Topic)) || Topic <- Topics],
SysInterval = proplists:get_value(sys_interval, Options, 60),
{ok, #state{}}.
@ -150,6 +150,3 @@ code_change(_OldVsn, State, _Extra) ->
%%% Internal functions
%%%=============================================================================
systop(Name) when is_atom(Name) ->
list_to_binary(lists:concat(["$SYS/brokers/", node(), "/", Name])).

View File

@ -123,3 +123,11 @@ retain | Retain(0, 1)
topic | Topic
message | Message
## Contributors
@hejin1026 <260495915 at qq.com>
@desoulter <assoulter123 at gmail.com>
@turtleDeng

View File

@ -66,17 +66,18 @@
{max_queue, 1000},
{store_qos0, false}
]},
%% MQTT Broker
{mqtt_broker, [
%% System interval of publishing broker $SYS messages
{sys_interval, 60}
]},
%% Retain messages
{retained, [
{max_message_num, 100000},
{max_playload_size, 4096}
]},
%% PubSub
{pubsub, []},
%% Broker
{broker, [
{sys_interval, 60}
]},
{mqtt_pubsub, []},
%% Metrics
{metrics, [
{pub_interval, 60}