<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 18, 2013 at 4:58 AM, Michael Klishin <span dir="ltr"><<a href="mailto:michael.s.klishin@gmail.com" target="_blank">michael.s.klishin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="im">2013/6/18 3k4b251 <span dir="ltr"><<a href="mailto:314992959@qq.com" target="_blank">314992959@qq.com</a>></span><br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="overflow:hidden">I know the channel of sender,but how can I know<br>
which queue this message from</div></blockquote></div><br></div>Every delivery has a consumer tag (identifier). The same tag will be availalbe on the basic.consume-ok method</div><div class="gmail_extra">returned by basic.consume (sorry, I'm not sure what function/struct exactly that translates in the C client).</div>
</div></blockquote><div><br></div><div style>The structs you'd care about in rabbitmq-c are:</div><div style><br></div><div style>amqp_basic_consume_ok_t (<a href="https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp_framing.h#L394">https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp_framing.h#L394</a>)</div>
<div style><br></div><div style>amqp_basic_deliver_t (<a href="https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp_framing.h#L427">https://github.com/alanxz/rabbitmq-c/blob/master/librabbitmq/amqp_framing.h#L427</a>) </div>
<div style><br></div><div style>The amqp_basic_deliver_t method is the first method delivered in this message reading loop:</div><div style><a href="https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_consumer.c#L81">https://github.com/alanxz/rabbitmq-c/blob/master/examples/amqp_consumer.c#L81</a><br>
</div><div style><br></div><div style>You can do the following to get an amqp_basic_delivery_t object from the frame:</div><div style><br></div><div style>amqp_basic_deliver_t *delivery = (amqp_basic_deliver_t *)frame.method.decoded;</div>
<div style><br></div><div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">
<div class="gmail_extra"><br></div><div class="gmail_extra">If you keep a mapping of consumers to queues, you will be able to look up queues by consumer tag.</div><div class="im"><div class="gmail_extra">-- <br>MK<br><br>
<a href="http://github.com/michaelklishin" target="_blank">http://github.com/michaelklishin</a><br>
<a href="http://twitter.com/michaelklishin" target="_blank">http://twitter.com/michaelklishin</a><br>
</div></div></div>
<br>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div><br></div></div>