[rabbitmq-discuss] redelivery after ACK

Simon MacMullen simon at rabbitmq.com
Wed Nov 7 12:50:26 GMT 2012


Hmm.

Acks only matter to the server if it receives them. I wonder if you are 
killing the script after it has sent acks, but before the server has 
received them. That's consistent with what you're seeing re some acks 
getting through when you ack a lot - those are the ones that made it all 
the way to the server before the client was killed.

You may also be running into the Nagle algorithm. Not sure how you would 
disable that for the Ruby gem. Is the author here?

Cheers, Simon

On 07/11/12 03:48, larry.edelstein at therealreal.com wrote:
> Hi folks - I'm new to RabbitMQ. I've got a problem and need some help.
>
> I've posted the question on Stack Overflow at
> http://stackoverflow.com/questions/13262738/redelivery-after-ack, so if
> you want to answer it there, please do! I'll do my best to repost, here,
> any answers I get there, so that rabbitmq-discuss list denizens can also
> see and discuss.
>
> So feel free to go to Stack Overflow, or read it here.
>
>
> Larry Edelstein
>
> Now Answers, Inc.
>
> m (415) 713-9148
>
> ribs at acm.org
>
>
> +++
>
> Why are my RabbitMQ messages being redelivered to my consumer after they
> have been ACKd? I'm new to RabbitMQ; I must be misusing it, or there's
> something wrong perhaps with the Ruby amqp gem.
>
>
> I have a ruby script that subscribes to a queue and acks each message.
> If I let it make it all the way through the messages, the messages
> really do disappear from the queue; they're not redelivered. But if I
> interrupt my script before they're all ACKd, and then start the script
> again, delivery starts anew from the first message.
>
>
> The behavior I'm seeing in code is reflected accurately by the RabbitMQ
> web management interface; the queue has messages, and despite the ACKs,
> they don't disappear.
>
>
> Clue: I put about 5000 messages in the queue. If I let the consumer ACK
> a significant amount, a few messages do actually appear to be removed
> from the queue (contrary to what I said above). I haven't been able to
> nail this phenomenon down.
>
>
> I'm using ruby 1.9.3, RabbitMQ 2.8.7, and the amqp ruby gem 0.9.8. It
> happens with producer and consumer on Ubuntu 12.0.4, or on Mac OS 10.7.4.
>
>
> What the heck??
>
>
> Here's the code for the consumer:
>
>
> # encoding: utf-8
>
> require "rubygems"
>
> require 'amqp'
>
> require 'aws-sdk'
>
> queue_name = "some.queue"
>
> begin
>
> AMQP.start("amqp://localhost:5672") do | connection |
>
> channel  = AMQP::Channel.new(connection)
>
> queue = channel.queue(queue_name, :durable => true)
>
> queue.subscribe(:ack => true) do | metadata, payload |
>
> metadata.ack
>
> end
>
> end
>
> end
>
>
> and here's the producer:
>
>
> # encoding: utf-8
>
> require "rubygems"
>
> require 'amqp'
>
> require 'aws-sdk'
>
> msg = ARGV[0]
>
> queue_name = "some.queue"
>
> begin
>
> AMQP.start("amqp://localhost:5672") do | connection |
>
> channel  = AMQP::Channel.new(connection)
>
> queue    = channel.queue(queue_name, :durable => true)
>
> (1..5000).each do | x |
>
> channel.default_exchange.publish x, :routing_key => queue_name,
> :persistent => true
>
> end
>
> end
>
> end
>
>
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>


-- 
Simon MacMullen
RabbitMQ, VMware


More information about the rabbitmq-discuss mailing list