Skip to content
This repository has been archived by the owner on Sep 11, 2022. It is now read-only.

undefined method `receive_status' for nil:NilClass (NoMethodError) during queue.status #94

Closed
thobruk opened this issue Jul 19, 2011 · 8 comments
Assignees
Milestone

Comments

@thobruk
Copy link

thobruk commented Jul 19, 2011

The following generates the error:

AMQP.start(:host => '127.0.0.1') do |connection|
#  connection =
  channel  = AMQP::Channel.new(connection)
  exchange = channel.direct("")
  queue    = channel.queue("indexer_queue", {:durable => true}).bind(exchange)

EM.add_periodic_timer(5) {
    queue.status do |num_messages, num_consumers|
      puts "msgs:#{num_messages}"
    end
}

end
/home/bthomas/.rvm/gems/ruby-1.9.2-p290/gems/amqp-0.7.1/lib/amqp/channel.rb:864:in `handle_method': undefined method `receive_status' for nil:NilClass (NoMethodError)
    from /home/bthomas/.rvm/gems/ruby-1.9.2-p290/gems/amqp-0.7.1/lib/amqp/channel.rb:792:in `process_frame'

etc...

How am I supposed to correctly check queue status ? Thanks ! Is queue.status an EM event callback ?

@thobruk
Copy link
Author

thobruk commented Jul 19, 2011

By the way queue.status with a block feels like a really wierd way to get status.

@thobruk thobruk closed this as completed Jul 19, 2011
@thobruk thobruk reopened this Jul 19, 2011
@michaelklishin
Copy link
Member

That documentation is not for 0.7.x but for 0.8.0.RCs. AMQP::Queue#status with a block has been around since day 1 of the gem (for 3 years now) so removing it is not an option. Also, despite many pseudo-synchronous features, amqp gem is fully async and the status operation itself is async.

@michaelklishin
Copy link
Member

0.7.2 was out yesterday, please try it and reopen if necessary. The code looks very reasonable but 0.7.x and 0.6.x series have plenty of limitations.

@ghost ghost assigned michaelklishin Jul 19, 2011
@michaelklishin
Copy link
Member

I just learned that

gem install amqp --pre

now installs 0.7.2 for some reason. Investigating…

@thobruk
Copy link
Author

thobruk commented Jul 19, 2011

I still get that error with 0.7.2. I have to drop the .bind(exchange) in order to prevent another error.

@michaelklishin
Copy link
Member

Yes, I am able to reproduce it on 0.7.x. I don't see any "other errors" but default exchange is automatically bound to all queues so there is no need to #bind.

I have a solution, adding a test now. 0.7.3 will be out within an hour.

@michaelklishin
Copy link
Member

0.7.3 is pushed to rubygems.org

@thobruk
Copy link
Author

thobruk commented Jul 19, 2011

Works a charm ! Thanks for the very quick response.

michaelklishin added a commit that referenced this issue Jul 19, 2011
… even in pretty tricky pseudo-sync code cases
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants