diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-03-25 14:18:45 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-03-25 14:18:45 +0000 |
commit | 6dfdefb70b21e870d13ee3d54614c91913fb726b (patch) | |
tree | 3d416b083f104e363884a25362717642d95f5485 | |
parent | 981b01d37ac84dcf2e6574bd41715d14f7d71417 (diff) | |
download | rabbitmq-server-6dfdefb70b21e870d13ee3d54614c91913fb726b.tar.gz |
Monitor consuming queue regardless of whether the consumer is CCN capable, only decide whether to send the CCN on that basis.bug26070
-rw-r--r-- | src/rabbit_channel.erl | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl index cafc507f..b9b39ac3 100644 --- a/src/rabbit_channel.erl +++ b/src/rabbit_channel.erl @@ -1203,24 +1203,15 @@ basic_consume(QueueName, NoAck, ConsumerPrefetch, ActualConsumerTag, consumer_monitor(ConsumerTag, State = #ch{consumer_mapping = ConsumerMapping, queue_monitors = QMons, - queue_consumers = QCons, - capabilities = Capabilities}) -> - case rabbit_misc:table_lookup( - Capabilities, <<"consumer_cancel_notify">>) of - {bool, true} -> - {#amqqueue{pid = QPid}, _CParams} = - dict:fetch(ConsumerTag, ConsumerMapping), - QCons1 = dict:update(QPid, - fun (CTags) -> - gb_sets:insert(ConsumerTag, CTags) - end, - gb_sets:singleton(ConsumerTag), - QCons), - State#ch{queue_monitors = pmon:monitor(QPid, QMons), - queue_consumers = QCons1}; - _ -> - State - end. + queue_consumers = QCons}) -> + {#amqqueue{pid = QPid}, _CParams} = + dict:fetch(ConsumerTag, ConsumerMapping), + QCons1 = dict:update(QPid, fun (CTags) -> + gb_sets:insert(ConsumerTag, CTags) + end, + gb_sets:singleton(ConsumerTag), QCons), + State#ch{queue_monitors = pmon:monitor(QPid, QMons), + queue_consumers = QCons1}. monitor_delivering_queue(NoAck, QPid, QName, State = #ch{queue_names = QNames, @@ -1273,9 +1264,14 @@ handle_consuming_queue_down(QPid, State = #ch{queue_consumers = QCons, %% not an HA failover. But the likelihood is not great and most users %% are unlikely to care. -cancel_consumer(CTag, QName, State = #ch{consumer_mapping = CMap}) -> - ok = send(#'basic.cancel'{consumer_tag = CTag, - nowait = true}, State), +cancel_consumer(CTag, QName, State = #ch{capabilities = Capabilities, + consumer_mapping = CMap}) -> + case rabbit_misc:table_lookup( + Capabilities, <<"consumer_cancel_notify">>) of + {bool, true} -> ok = send(#'basic.cancel'{consumer_tag = CTag, + nowait = true}, State); + _ -> ok + end, rabbit_event:notify(consumer_deleted, [{consumer_tag, CTag}, {channel, self()}, {queue, QName}]), |