summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2013-04-15 13:49:55 +0100
committerEmile Joubert <emile@rabbitmq.com>2013-04-15 13:49:55 +0100
commit46c993c708b742dafae8a80c92a36ba125bde771 (patch)
treef91f30fdd2be829de790d0552e7ab40d8cb48f22 /src
parent2fd4ad1946f21bc0a49c38a261b5c871379781ff (diff)
downloadrabbitmq-server-git-46c993c708b742dafae8a80c92a36ba125bde771.tar.gz
Ignore missing exchange decorators
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_exchange.erl9
-rw-r--r--src/rabbit_exchange_decorator.erl12
2 files changed, 17 insertions, 4 deletions
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index 6d111b8316..e7847673b4 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 3bc9de1ead..19cbf92f80 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.