diff options
author | Emile Joubert <emile@rabbitmq.com> | 2013-04-15 13:49:55 +0100 |
---|---|---|
committer | Emile Joubert <emile@rabbitmq.com> | 2013-04-15 13:49:55 +0100 |
commit | e4cfae04a643a3a960dbd53272649c32cd2b13cb (patch) | |
tree | f91f30fdd2be829de790d0552e7ab40d8cb48f22 | |
parent | 59664eeaa335252c7b4bdb0c6fbc33a3ec52c302 (diff) | |
download | rabbitmq-server-e4cfae04a643a3a960dbd53272649c32cd2b13cb.tar.gz |
Ignore missing exchange decorators
-rw-r--r-- | src/rabbit_exchange.erl | 9 | ||||
-rw-r--r-- | src/rabbit_exchange_decorator.erl | 12 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl index 6d111b83..e7847673 100644 --- a/src/rabbit_exchange.erl +++ b/src/rabbit_exchange.erl @@ -113,8 +113,17 @@ recover() -> callback(X, create, map_create_tx(Tx), [X]) end, rabbit_durable_exchange), + report_missing_decorators(Xs), [XName || #exchange{name = XName} <- Xs]. +report_missing_decorators(Xs) -> + Mods = lists:usort(lists:append([rabbit_exchange_decorator:select(raw, D) || + #exchange{decorators = D} <- Xs])), + case [M || M <- Mods, code:which(M) =:= non_existing] of + [] -> ok; + M -> rabbit_log:warning("Missing exchange decorators: ~p~n", [M]) + end. + callback(X = #exchange{type = XType, decorators = Decorators}, Fun, Serial0, Args) -> Serial = if is_function(Serial0) -> Serial0; diff --git a/src/rabbit_exchange_decorator.erl b/src/rabbit_exchange_decorator.erl index 3bc9de1e..19cbf92f 100644 --- a/src/rabbit_exchange_decorator.erl +++ b/src/rabbit_exchange_decorator.erl @@ -84,11 +84,13 @@ behaviour_info(_Other) -> %%---------------------------------------------------------------------------- -list() -> [M || {_, M} <- rabbit_registry:lookup_all(exchange_decorator)]. - %% select a subset of active decorators -select(all, {Route, NoRoute}) -> Route ++ NoRoute; -select(route, {Route, _NoRoute}) -> Route. +select(all, {Route, NoRoute}) -> filter(Route ++ NoRoute); +select(route, {Route, _NoRoute}) -> filter(Route); +select(raw, {Route, NoRoute}) -> Route ++ NoRoute. + +filter(Modules) -> + [M || M <- Modules, code:which(M) =/= non_existing]. set(X) -> X#exchange{ @@ -99,5 +101,7 @@ set(X) -> cons_if_eq(noroute, Callbacks, D, NoRoute)} end, {[], []}, list())}. +list() -> [M || {_, M} <- rabbit_registry:lookup_all(exchange_decorator)]. + cons_if_eq(Select, Select, Item, List) -> [Item | List]; cons_if_eq(_Select, _Other, _Item, List) -> List. |