diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2014-03-31 15:25:02 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2014-03-31 15:25:02 +0100 |
| commit | 59cfadfd108e8760d87d845754ca5190acfe279d (patch) | |
| tree | 6efa352dff0decb60abb69bd60cdbdaea4a98e13 /src | |
| parent | 461d726beb8250bb590fef5e9495a9f649e1903b (diff) | |
| download | rabbitmq-server-git-59cfadfd108e8760d87d845754ca5190acfe279d.tar.gz | |
Events for policies and parameters.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_policy.erl | 6 | ||||
| -rw-r--r-- | src/rabbit_runtime_parameters.erl | 17 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/rabbit_policy.erl b/src/rabbit_policy.erl index 06bfaf179a..632f2c66d5 100644 --- a/src/rabbit_policy.erl +++ b/src/rabbit_policy.erl @@ -200,10 +200,12 @@ validate(_VHost, <<"policy">>, Name, Term) -> rabbit_parameter_validation:proplist( Name, policy_validation(), Term). -notify(VHost, <<"policy">>, _Name, _Term) -> +notify(VHost, <<"policy">>, Name, Term) -> + rabbit_event:notify(policy_set, [{name, Name} | Term]), update_policies(VHost). -notify_clear(VHost, <<"policy">>, _Name) -> +notify_clear(VHost, <<"policy">>, Name) -> + rabbit_event:notify(policy_cleared, [{name, Name}]), update_policies(VHost). %%---------------------------------------------------------------------------- diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl index 877714a1d5..ba6b953871 100644 --- a/src/rabbit_runtime_parameters.erl +++ b/src/rabbit_runtime_parameters.erl @@ -99,7 +99,11 @@ set_any0(VHost, Component, Name, Term) -> ok -> case mnesia_update(VHost, Component, Name, Term) of {old, Term} -> ok; - _ -> Mod:notify(VHost, Component, Name, Term) + _ -> event_notify( + parameter_set, VHost, Component, + [{name, Name}, + {value, Term}]), + Mod:notify(VHost, Component, Name, Term) end, ok; E -> @@ -136,7 +140,10 @@ clear_any(VHost, Component, Name) -> not_found -> {error_string, "Parameter does not exist"}; _ -> mnesia_clear(VHost, Component, Name), case lookup_component(Component) of - {ok, Mod} -> Mod:notify_clear(VHost, Component, Name); + {ok, Mod} -> event_notify( + parameter_cleared, VHost, Component, + [{name, Name}]), + Mod:notify_clear(VHost, Component, Name); _ -> ok end end. @@ -147,6 +154,12 @@ mnesia_clear(VHost, Component, Name) -> end, ok = rabbit_misc:execute_mnesia_transaction(rabbit_vhost:with(VHost, F)). +event_notify(_Event, _VHost, <<"policy">>, _Props) -> + ok; +event_notify(Event, VHost, Component, Props) -> + rabbit_event:notify(Event, [{vhost, VHost}, + {component, Component} | Props]). + list() -> [p(P) || #runtime_parameters{ key = {_VHost, Comp, _Name}} = P <- rabbit_misc:dirty_read_all(?TABLE), Comp /= <<"policy">>]. |
