summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2013-03-08 12:18:26 +0000
committerEmile Joubert <emile@rabbitmq.com>2013-03-08 12:18:26 +0000
commitbd2905c7b21c4f75fea8bd1d61e49043c7bf6dc2 (patch)
tree537b591cd1fadb2340fa4db98ddc57483789475e /src
parent0f471c546032d497ef2090fab8c4e4c7ad6c7a27 (diff)
downloadrabbitmq-server-bd2905c7b21c4f75fea8bd1d61e49043c7bf6dc2.tar.gz
Mostly callback description
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_exchange.erl11
-rw-r--r--src/rabbit_exchange_decorator.erl8
2 files changed, 11 insertions, 8 deletions
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index 0e7872f6..7179454d 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -317,13 +317,12 @@ route(#exchange{name = #resource{name = RName, virtual_host = VHost} = XName} =
case {registry_lookup(exchange_decorator_route) == [], RName == <<"">>} of
{true, true} ->
[rabbit_misc:r(VHost, queue, RK) || RK <- lists:usort(RKs)];
- {NoDecor, _} ->
+ {NoDecorator, _} ->
QNames = route1(Delivery, {[X], XName, []}),
- lists:usort(
- case NoDecor of
- true -> QNames;
- false -> decorate_route(X, Delivery, QNames)
- end)
+ lists:usort(case NoDecorator of
+ true -> QNames;
+ false -> decorate_route(X, Delivery, QNames)
+ end)
end.
decorate_route(X, Delivery, QNames) ->
diff --git a/src/rabbit_exchange_decorator.erl b/src/rabbit_exchange_decorator.erl
index 4e395cbe..70ba4d22 100644
--- a/src/rabbit_exchange_decorator.erl
+++ b/src/rabbit_exchange_decorator.erl
@@ -21,9 +21,8 @@
%% 1) It applies to all exchanges as soon as it is installed, therefore
%% 2) It is not allowed to affect validation, so no validate/1 or
%% assert_args_equivalence/2
-%% 3) It also can't affect routing
%%
-%% It's possible in the future we might relax 3), or even make these
+%% It's possible in the future we might make decorators
%% able to manipulate messages as they are published.
-ifdef(use_specs).
@@ -58,6 +57,11 @@
-callback policy_changed (
serial(), rabbit_types:exchange(), rabbit_types:exchange()) -> 'ok'.
+%% called after exchange routing
+%% return value is a tuple of two lists: queues to be added
+%% and queues to be removed from the list of destination queues.
+%% decorators must register separately for this callback using
+%% exchange_decorator_route.
-callback route ( rabbit_types:exchange(), rabbit_types:delivery(),
[rabbit_amqqueue:name()]) ->
{[rabbit_amqqueue:name()], [rabbit_amqqueue:name()]}.