This is the gist of mine:<div><br></div><div><div>def get_channel(self):</div><div>        &quot;&quot;&quot;</div><div>            Creates a persistent, ack based, non-exclusive queue/exchange using the routing key event</div>

<div>            </div><div>            Non-exclusivity allows any consumer to grab from the queue</div><div>        &quot;&quot;&quot;</div><div>        channel = self.connection.channel()</div><div>        </div><div>        channel.queue_declare(queue=&#39;storage&#39;, durable=True, exclusive=False, auto_delete=False)</div>

<div>        channel.exchange_declare(exchange=&#39;records&#39;, type=&#39;direct&#39;, durable=True, auto_delete=False)</div><div>        channel.queue_bind(queue=&#39;storage&#39;, exchange=&#39;records&#39;, routing_key=&#39;event&#39;)</div>

<div>        </div><div>        channel.basic_consume(</div><div>            queue=&#39;storage&#39;, no_ack=False, callback=self.recv_event_record, </div><div>            consumer_tag=self.consumer_tag</div><div>        )</div>

<div>        </div><div>        self.channel = channel</div><div>        </div><div>        return channel</div><div>        </div><div>    def recv_event_record(self, data):</div><div>        &quot;&quot;&quot;</div><div>

            Cleans up the record, passes it on for processing</div><div>        &quot;&quot;&quot;</div><div>        </div><div>        item = cjson.decode(unicode(data.body).encode(&quot;utf8&quot;))</div><div>       </div>

<div>        [processing...]</div><div>        </div><div>        <a href="http://logging.info">logging.info</a>(&#39;[id: &#39; + str(self.consumer_id) + &#39;] Received queue item, processing...&#39;)</div><div>        </div>

<div>        self.process_record(record)</div><div>        self.channel.basic_ack(data.delivery_tag)</div><div>        </div><div>        <a href="http://logging.info">logging.info</a>(&#39;[id: &#39; + str(self.consumer_id) + &#39;] Processing complete, acknowledged.&#39;)</div>

<div><br></div><div>    def process_record(self, item):</div><div>        process(item)</div><div><br></div><div>def connect_consumer():</div><div>    channel = get_channel()</div><div>    </div><div>    <a href="http://logging.info">logging.info</a>(&#39;Consumer started&#39;)</div>

<div>    </div><div>    while True:</div><div>        channel.wait()</div><br><div class="gmail_quote">On Tue, Sep 8, 2009 at 7:01 AM, Chuck Remes <span dir="ltr">&lt;<a href="mailto:cremes.devlist@mac.com">cremes.devlist@mac.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Aisha is mistaken. The ruby amqp library does not use libevent<br>
anywhere. It uses EventMachine under the covers which is a home-grown<br>
reactor written in C that uses select, poll and kqueue depending on<br>
the platform.<br>
<font color="#888888"><br>
cr<br>
</font><div><div></div><div class="h5"><br>
<br>
On Sep 8, 2009, at 8:33 AM, Ben Hood wrote:<br>
<br>
&gt; Aisha,<br>
&gt;<br>
&gt; Not wanting to hijack this thread another time, but....<br>
&gt;<br>
&gt; On Mon, Sep 7, 2009 at 10:44 PM, Aisha<br>
&gt; Fenton&lt;<a href="mailto:aisha.fenton@gmail.com">aisha.fenton@gmail.com</a>&gt; wrote:<br>
&gt;&gt; The library I&#39;m using (<a href="http://github.com/celldee/bunny/tree/master" target="_blank">http://github.com/celldee/bunny/tree/master</a>)<br>
&gt;&gt; is<br>
&gt;&gt; synchronous only. I&#39;m considering switching to (<a href="http://github.com/tmm1/amqp/tree/master" target="_blank">http://github.com/tmm1/amqp/tree/master</a><br>
&gt;&gt; ) which is async and uses libevent. However, I&#39;ve read that there are<br>
&gt;&gt; problems with msg acknowledges in apps that use libevent, because the<br>
&gt;&gt; OS can buffer the ack responses. And although I&#39;m not using ack<br>
&gt;&gt; yet, I<br>
&gt;&gt; want to in my production system.<br>
&gt;<br>
&gt; I am interested as to what the specific issue is with sending acks<br>
&gt; with libevent - are you saying that the app can issue an ack and this<br>
&gt; can potentially go AWOL between the the libevent API returning and the<br>
&gt; point it time when the AMQP frame is actually written to the socket?<br>
&gt;<br>
&gt; Ben<br>
<br>
<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="http://mixpanel.com">http://mixpanel.com</a><br>Blog: <a href="http://blog.mixpanel.com">http://blog.mixpanel.com</a><br>
</div>