<div dir="ltr">Inlined below.<br><div class="gmail_extra"><br>-Alan<br><br><div class="gmail_quote">On Fri, Jun 14, 2013 at 3:18 AM, 3k4b251 <span dir="ltr">&lt;<a href="mailto:314992959@qq.com" target="_blank">314992959@qq.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">&lt;<a href="http://rabbitmq.1065348.n5.nabble.com/file/n27390/list_queue.jpg" target="_blank">http://rabbitmq.1065348.n5.nabble.com/file/n27390/list_queue.jpg</a>&gt;<br>

<br>
you can see �tha � I �get �four �messages �in the �queue -----fb_test_2<br>
,so �I �will �use �function wait_simple_frame() �to �receive � msg in a<br>
thread.<br>
<br>
<br>
in �the void main(){};<br>
<br>
Scene 1:<br>
I �open �the �channel �1 �: �amqp_channel_open(conn,1);<br>
ask consumer � :amqp_basic_consume(conn,1...);<br>
I get �the �message from �queue---fb_test_2<br>
<br>
Scene 2:<br>
I �did �nothing;<br>
I �block � in the �wait_simple_frame() �and nothing receive;<br>
<br>
Scene 3:<br>
I �open the channel �1: �amqp_channel_open(conn,1);<br>
I ask �consumer : �amqp_basic_consume(conn,1...);<br>
then I close the channel immediately : �amqp_channel_close(conn,1);<br>
but what happens, �I �still �receive �the message... I don&#39;t �think �I<br>
should receive them. �what&#39; the problem?<br></blockquote><div><br></div><div style>You&#39;re seeing the result of the network buffering. As soon as the broker received the basic.consume method, if there are messages in the queue, the broker will start sending queued messages to the client. Even though you immediately closed the channel, because it takes time to send the channel.close method across the network, the broker will still have time to send messages to the client before the channel is closed. You are seeing messages that are sent before the broker closes the channel.</div>
<div style><br></div><div style>This is expected behavior.</div><div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://rabbitmq.1065348.n5.nabble.com/rabbitmq-c-close-channel-already-but-still-get-message-from-the-channel-tp27390.html" target="_blank">http://rabbitmq.1065348.n5.nabble.com/rabbitmq-c-close-channel-already-but-still-get-message-from-the-channel-tp27390.html</a><br>

Sent from the RabbitMQ mailing list archive at Nabble.com.<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>
</blockquote></div><br></div></div>