anchor.diff:  -export([consumer_count/1]).
   
   -import(rabbit_sharding_util, [a2b/1, shards_per_node/1]).
  --import(rabbit_misc, [r/3]).
  +-import(rabbit_misc, [r/3, format/2]).
   
   -rabbit_boot_step({?MODULE,
                      [{description, "sharding interceptor"},
                       {mfa, {rabbit_registry, register,
  -                           [channel_interceptor, <<"sharding interceptor">>, ?MODULE]}},
  +                           [channel_interceptor,
  +                            <<"sharding interceptor">>, ?MODULE]}},
                       {cleanup, {rabbit_registry, unregister,
  -                               [channel_interceptor, <<"sharding interceptor">>]}},
  +                               [channel_interceptor,
  +                                <<"sharding interceptor">>]}},
                       {requires, rabbit_registry},
                       {enables, recovery}]}).
   
  
positive.code: intercept(#'queue.bind'{queue = QName} = Method, VHost) ->
      case is_sharded(VHost, QName) of
          true ->
              {error, rabbit_misc:format("Can't bind sharded queue: ~p", [QName])};
          _    ->
              {ok, Method}
      end;
  
negative.code:     end.
  
  lookup_exchange(VHost, QBin) ->
      rabbit_exchange:lookup(r(VHost, exchange, QBin)).
  
  least_consumers(VHost, QBin, N) ->
      F = fun(QNum) ->
                  QBin2 = rabbit_sharding_util:make_queue_name(
                            QBin, a2b(node()), QNum),
                  case consumer_count(r(VHost, queue, QBin2)) of
                      {error, E}       -> {error, E};
                      [{consumers, C}] -> {C, QBin2}
                  end
  