[rabbitmq-discuss] Channel.Close w/ subscribed consumers

Aman Gupta rabbitmq at tmm1.net
Mon Nov 30 19:43:23 GMT 2009


On Mon, Nov 30, 2009 at 7:26 AM, Matthias Radestock <matthias at lshift.net> wrote:
> Aman,
>
> Aman Gupta wrote:
>>
>> With the latest rabbitmq, I'm seeing strange behavior where a
>> Channel.Close is not acknowledged with a Close-Ok until after
>> subscribed consumers on that channel stop receiving messages.
>
> latest == RabbitMQ 1.7.0?
>
> I don't recall any changes in that area vs 1.6.x

I haven't tested this since rabbit 1.4, so I'm not sure when the
behavior changed. I'm currently testing with the hg default branch.

>
>> To reproduce:
>>
>> publisher process:
>>  publish message to test-queue at a high rate (500 messages/second)
>>
>> subscriber process:
>>  subscribe to test-queue
>>  send a Channel.Close on the channel after 1 second
>>
>> A Channel.CloseOk will not be received until after the publisher
>> process is stopped and all the messages in the queue are consumed by
>> the subscriber.
>
> Can you send us the complete code to reproduce this?

Sure:

publisher.rb:

require 'mq'
AMQP.start(:host => 'localhost') do
  EM.add_periodic_timer(0) {
    puts "Publishing #{Time.now}"
    MQ.queue("testqueue").publish("message: #{Time.now}")
  }
end


subscriber.rb:

require 'mq'
trap("INT") { puts "calling amqp.stop @ #{Time.now}"; AMQP.stop { puts
"inside amqp.stop @ #{Time.now}"; EM.stop } }
# AMQP.logging=true
AMQP.start(:host => 'localhost') do
  MQ.queue("testqueue").subscribe do |msg|
    puts "Got message: #{msg.inspect}"
    #sleep 1
  end
end


sending the subscriber process a SIGINT will send a Channel.Close.
When a Channel.Close-Ok is received, it prints out "inside amqp.stop"
and ends the process. This never happens while the publisher is still
running.

  Aman

>
>
> Regards,
>
> Matthias.
>




More information about the rabbitmq-discuss mailing list