[rabbitmq-discuss] rabbitmq-c how many channels I need?
Alan Antonuk
alan.antonuk at gmail.com
Tue Jun 18 17:51:38 BST 2013
On Tue, Jun 18, 2013 at 4:58 AM, Michael Klishin <
michael.s.klishin at gmail.com> wrote:
> 2013/6/18 3k4b251 <314992959 at qq.com>
>
>> I know the channel of sender,but how can I know
>> which queue this message from
>>
>
> Every delivery has a consumer tag (identifier). The same tag will be
> availalbe on the basic.consume-ok method
> returned by basic.consume (sorry, I'm not sure what function/struct
> exactly that translates in the C client).
>
The structs you'd care about in rabbitmq-c are:
amqp_basic_consume_ok_t (
https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp_framing.h#L394
)
amqp_basic_deliver_t (
https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp_framing.h#L427
)
The amqp_basic_deliver_t method is the first method delivered in this
message reading loop:
https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_consumer.c#L81
You can do the following to get an amqp_basic_delivery_t object from the
frame:
amqp_basic_deliver_t *delivery = (amqp_basic_deliver_t
*)frame.method.decoded;
> If you keep a mapping of consumers to queues, you will be able to look up
> queues by consumer tag.
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130618/982e87d0/attachment.htm>
More information about the rabbitmq-discuss
mailing list