diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2011-05-19 12:04:27 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2011-05-19 12:04:27 +0100 |
commit | a0588a3cdf4f5c56ea7d1c845c21ecdeaa0ae76f (patch) | |
tree | 62a87b9f19f4bf0f15f37b63b8d380b0d8262311 | |
parent | 1e2c482d34e80270518e58311105772763df730e (diff) | |
download | rabbitmq-server-a0588a3cdf4f5c56ea7d1c845c21ecdeaa0ae76f.tar.gz |
rabbitmqctl refresh_channel_config
-rw-r--r-- | docs/rabbitmqctl.1.xml | 8 | ||||
-rw-r--r-- | src/rabbit_channel.erl | 11 | ||||
-rw-r--r-- | src/rabbit_control.erl | 4 |
3 files changed, 22 insertions, 1 deletions
diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml index 62869158..24228f41 100644 --- a/docs/rabbitmqctl.1.xml +++ b/docs/rabbitmqctl.1.xml @@ -1323,6 +1323,14 @@ </listitem> </varlistentry> + <varlistentry> + <term><cmdsynopsis><command>refresh_channel_config</command></cmdsynopsis></term> + <listitem> + <para> + Tell all channels to refresh their configuration (currently only the value of <code>trace_exchanges</code>). + </para> + </listitem> + </varlistentry> </variablelist> </refsect2> </refsect1> diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index 2517528a..301efb43 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -23,7 +23,7 @@ -export([start_link/10, do/2, do/3, flush/1, shutdown/1]). -export([send_command/2, deliver/4, flushed/2, confirm/2]). -export([list/0, info_keys/0, info/1, info/2, info_all/0, info_all/1]). --export([emit_stats/1, ready_for_close/1]). +-export([emit_stats/1, ready_for_close/1, refresh_config_all/0]). -export([init/1, terminate/2, code_change/3, handle_call/3, handle_cast/2, handle_info/2, handle_pre_hibernate/1, prioritise_call/3, @@ -89,6 +89,7 @@ -spec(info/2 :: (pid(), rabbit_types:info_keys()) -> rabbit_types:infos()). -spec(info_all/0 :: () -> [rabbit_types:infos()]). -spec(info_all/1 :: (rabbit_types:info_keys()) -> [rabbit_types:infos()]). +-spec(refresh_config_all/0 :: () -> 'ok'). -spec(emit_stats/1 :: (pid()) -> 'ok'). -spec(ready_for_close/1 :: (pid()) -> 'ok'). @@ -146,6 +147,11 @@ info_all() -> info_all(Items) -> rabbit_misc:filter_exit_map(fun (C) -> info(C, Items) end, list()). +refresh_config_all() -> + rabbit_misc:upmap( + fun (C) -> gen_server2:call(C, refresh_config) end, list()), + ok. + emit_stats(Pid) -> gen_server2:cast(Pid, emit_stats). @@ -219,6 +225,9 @@ handle_call({info, Items}, _From, State) -> catch Error -> reply({error, Error}, State) end; +handle_call(refresh_config, _From, State = #ch{virtual_host = VHost}) -> + reply(ok, State#ch{trace_state = rabbit_trace:init(VHost)}); + handle_call(_Request, _From, State) -> noreply(State). diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index 6ab07111..6966fd04 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -295,6 +295,10 @@ action(unset_env, Node, [Var], _Opts, Inform) -> Inform("Clearing control variable ~s for node ~p", [Var, Node]), rpc_call(Node, application, unset_env, [rabbit, parse(Var)]); +action(refresh_channel_config, Node, [], _Opts, Inform) -> + Inform("Telling channels to refresh configuration", []), + rpc_call(Node, rabbit_channel, refresh_config_all, []); + action(set_permissions, Node, [Username, CPerm, WPerm, RPerm], Opts, Inform) -> VHost = proplists:get_value(?VHOST_OPT, Opts), Inform("Setting permissions for user ~p in vhost ~p", [Username, VHost]), |