[rabbitmq-discuss] Identifying queues in consuming channels

Simon MacMullen simon at rabbitmq.com
Thu Sep 20 16:14:01 BST 2012


On 20/09/12 16:04, m.luchak at smartasking.com wrote:
> Hi everyone,

Please start new threads for new topics. This really has nothing to do 
with badmatch in the message store.

> Is there a way to return what Q a msg arrived on (in java client) ?
>
> I have a channel with multiple consumers subscribed to multiple Qs and I
> would like to take action depending on the name of the queue that the
> message arrived on... something like
> "delivery.getEnvelope().getExchange()" - great, I have the exchange but
> is there a similar property for consumer or channel to get the Q that
> the msg arrived on?

Not the queue directly, but each consumer has a consumer tag, which 
shows up in handleDelivery(). So you can either let the server give you 
a consumer tag at basicConsume() time, and maintain a map of consumer 
tag -> queue name, or you can specify the consumer tag yourself as the 
queue name, then you don't need to maintain the mapping.

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, VMware


More information about the rabbitmq-discuss mailing list