diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2013-08-20 15:22:18 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2013-08-20 15:22:18 +0100 |
commit | 81080c1b4388dae2420e6e32406d943f884a2e30 (patch) | |
tree | 155fdd00784f6d55b1ee20bb0b03a0a647c38d6c | |
parent | ebb60751b05ac08827eef253e4401919fdf8add3 (diff) | |
download | rabbitmq-server-81080c1b4388dae2420e6e32406d943f884a2e30.tar.gz |
Push everything through notify_decorators/3.
-rw-r--r-- | src/rabbit_amqqueue_process.erl | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl index e432f226..4d8e1c19 100644 --- a/src/rabbit_amqqueue_process.erl +++ b/src/rabbit_amqqueue_process.erl @@ -198,7 +198,7 @@ declare(Recover, From, State = #q{q = Q, recovery_barrier(Recover), State1 = process_args(State#q{backing_queue = BQ, backing_queue_state = BQS}), - callback(qname(State), startup, []), + notify_decorators(startup, [], State), rabbit_event:notify(queue_created, infos(?CREATION_EVENT_KEYS, State1)), rabbit_event:if_enabled(State1, #q.stats_timer, @@ -223,7 +223,19 @@ matches(new, Q1, Q2) -> matches(_, Q, Q) -> true; matches(_, _Q, _Q1) -> false. -callback(QName, F, A) -> +notify_decorators(Event, Props, State) when Event =:= startup; + Event =:= shutdown -> + decorator_callback(qname(State), Event, Props); + +notify_decorators(Event, Props, State = #q{active_consumers = ACs, + backing_queue = BQ, + backing_queue_state = BQS}) -> + decorator_callback( + qname(State), notify, + [Event, [{max_active_consumer_priority, priority_queue:highest(ACs)}, + {is_empty, BQ:is_empty(BQS)} | Props]]). + +decorator_callback(QName, F, A) -> %% Look up again in case policy and hence decorators have changed case rabbit_amqqueue:lookup(QName) of {ok, Q = #amqqueue{decorators = Ds}} -> @@ -232,14 +244,6 @@ callback(QName, F, A) -> ok end. -notify_decorators(Event, Props, State = #q{active_consumers = ACs, - backing_queue = BQ, - backing_queue_state = BQS}) -> - callback(qname(State), notify, - [Event, - [{max_active_consumer_priority, priority_queue:highest(ACs)}, - {is_empty, BQ:is_empty(BQS)} | Props]]). - bq_init(BQ, Q, Recover) -> Self = self(), BQ:init(Q, Recover =/= new, @@ -293,7 +297,7 @@ terminate_shutdown(Fun, State) -> undefined -> State1; _ -> ok = rabbit_memory_monitor:deregister(self()), QName = qname(State), - callback(QName, shutdown, []), + notify_decorators(shutdown, [], State), [emit_consumer_deleted(Ch, CTag, QName) || {Ch, CTag, _} <- consumers(State1)], State1#q{backing_queue_state = Fun(BQS)} |