<font face="arial" size="2"><p style="margin:0;padding:0;">Surely if I have a 1-second delay after I send the ACK, it will have arrived at the server. What would stop it?</p>
<p style="margin:0;padding:0;"> </p>
<p style="margin:0;padding:0;">All the same, I think I'll fire up Wireshark and see what's happening.</p>
<p style="margin:0;padding:0;"> </p>
<p style="margin:0;padding:0;">-larry</p>
<p style="margin:0;padding:0;"> </p>
<p style="margin:0;padding:0;">-----Original Message-----<br />From: "Simon MacMullen" <simon@rabbitmq.com><br />Sent: Wednesday, November 7, 2012 4:50am<br />To: "Discussions about RabbitMQ" <rabbitmq-discuss@lists.rabbitmq.com><br />Cc: larry.edelstein@therealreal.com<br />Subject: Re: [rabbitmq-discuss] redelivery after ACK<br /><br /></p>
<div id="SafeStyles1352402445">
<p style="margin:0;padding:0;">Hmm.<br /><br />Acks only matter to the server if it receives them. I wonder if you are <br />killing the script after it has sent acks, but before the server has <br />received them. That's consistent with what you're seeing re some acks <br />getting through when you ack a lot - those are the ones that made it all <br />the way to the server before the client was killed.<br /><br />You may also be running into the Nagle algorithm. Not sure how you would <br />disable that for the Ruby gem. Is the author here?<br /><br />Cheers, Simon<br /><br />On 07/11/12 03:48, larry.edelstein@therealreal.com wrote:<br />> Hi folks - I'm new to RabbitMQ. I've got a problem and need some help.<br />><br />> I've posted the question on Stack Overflow at<br />> http://stackoverflow.com/questions/13262738/redelivery-after-ack, so if<br />> you want to answer it there, please do! I'll do my best to repost, here,<br />> any answers I get there, so that rabbitmq-discuss list denizens can also<br />> see and discuss.<br />><br />> So feel free to go to Stack Overflow, or read it here.<br />><br />><br />> Larry Edelstein<br />><br />> Now Answers, Inc.<br />><br />> m (415) 713-9148<br />><br />> ribs@acm.org<br />><br />><br />> +++<br />><br />> Why are my RabbitMQ messages being redelivered to my consumer after they<br />> have been ACKd? I'm new to RabbitMQ; I must be misusing it, or there's<br />> something wrong perhaps with the Ruby amqp gem.<br />><br />><br />> I have a ruby script that subscribes to a queue and acks each message.<br />> If I let it make it all the way through the messages, the messages<br />> really do disappear from the queue; they're not redelivered. But if I<br />> interrupt my script before they're all ACKd, and then start the script<br />> again, delivery starts anew from the first message.<br />><br />><br />> The behavior I'm seeing in code is reflected accurately by the RabbitMQ<br />> web management interface; the queue has messages, and despite the ACKs,<br />> they don't disappear.<br />><br />><br />> Clue: I put about 5000 messages in the queue. If I let the consumer ACK<br />> a significant amount, a few messages do actually appear to be removed<br />> from the queue (contrary to what I said above). I haven't been able to<br />> nail this phenomenon down.<br />><br />><br />> I'm using ruby 1.9.3, RabbitMQ 2.8.7, and the amqp ruby gem 0.9.8. It<br />> happens with producer and consumer on Ubuntu 12.0.4, or on Mac OS 10.7.4.<br />><br />><br />> What the heck??<br />><br />><br />> Here's the code for the consumer:<br />><br />><br />> # encoding: utf-8<br />><br />> require "rubygems"<br />><br />> require 'amqp'<br />><br />> require 'aws-sdk'<br />><br />> queue_name = "some.queue"<br />><br />> begin<br />><br />> AMQP.start("amqp://localhost:5672") do | connection |<br />><br />> channel = AMQP::Channel.new(connection)<br />><br />> queue = channel.queue(queue_name, :durable => true)<br />><br />> queue.subscribe(:ack => true) do | metadata, payload |<br />><br />> metadata.ack<br />><br />> end<br />><br />> end<br />><br />> end<br />><br />><br />> and here's the producer:<br />><br />><br />> # encoding: utf-8<br />><br />> require "rubygems"<br />><br />> require 'amqp'<br />><br />> require 'aws-sdk'<br />><br />> msg = ARGV[0]<br />><br />> queue_name = "some.queue"<br />><br />> begin<br />><br />> AMQP.start("amqp://localhost:5672") do | connection |<br />><br />> channel = AMQP::Channel.new(connection)<br />><br />> queue = channel.queue(queue_name, :durable => true)<br />><br />> (1..5000).each do | x |<br />><br />> channel.default_exchange.publish x, :routing_key => queue_name,<br />> :persistent => true<br />><br />> end<br />><br />> end<br />><br />> end<br />><br />><br />><br />><br />> _______________________________________________<br />> rabbitmq-discuss mailing list<br />> rabbitmq-discuss@lists.rabbitmq.com<br />> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss<br />><br /><br /><br />-- <br />Simon MacMullen<br />RabbitMQ, VMware</p>
</div></font>