Skip to content

Instantly share code, notes, and snippets.

@michaelklishin
Created October 11, 2012 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelklishin/61951978dab3b7e742df to your computer and use it in GitHub Desktop.
Save michaelklishin/61951978dab3b7e742df to your computer and use it in GitHub Desktop.
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} = 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment