Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Undefined method subscription #50

Closed
23tux opened this Issue · 1 comment

3 participants

@23tux

I found an error when starting some examples (Ruby 1.9.3-p125). I started in one terminal the simple_consumer.rb and in the other the simple_publisher.rb. The simple_consumer.rb returns some (in my opinion) strange debug data:

simple_consumer.rb

I, [2012-04-16 10:01:38#697]  INFO -- received: ?

?
 capabilitiesF  copyrightS$Copyright (C) 2007-2011 VMware, Inc.
                                                               informationS5Licensed under the MPL.  See http://www.rabbitmq.complatformS
Erlang/OTPproductRabbitMQversionS2.7.1PLAIN AMQPLAINen_US?
I, [2012-04-16 10:01:38#697]  INFO -- send: ?

platformSRubyproductSBunny
                          informationS!http://github.com/ruby-amqp/bunnyversionS0.7.AMQPLAIN#LOGINSguesPASSWORDSguesten_US?
I, [2012-04-16 10:01:38#697]  INFO -- received: 

?
I, [2012-04-16 10:01:38#697]  INFO -- send: 

?
I, [2012-04-16 10:01:38#697]  INFO -- send: 
(/?
I, [2012-04-16 10:01:38#697]  INFO -- received: 
)?
I, [2012-04-16 10:01:38#697]  INFO -- send: 
?
I, [2012-04-16 10:01:38#697]  INFO -- received: 
                                                ?
I, [2012-04-16 10:01:38#697]  INFO -- send: 

/data?
I, [2012-04-16 10:01:38#697]  INFO -- received: 
                                                ?
I, [2012-04-16 10:01:38#697]  INFO -- send: 2
po_box?
I, [2012-04-16 10:01:38#697]  INFO -- received: 2
                                                 po_box?
I, [2012-04-16 10:01:38#697]  INFO -- send: (

sorting_roomdirect?
I, [2012-04-16 10:01:38#697]  INFO -- received: (
                                                 ?
I, [2012-04-16 10:01:38#697]  INFO -- send: $2po_box
                                                    sorting_roomfred?
I, [2012-04-16 10:01:38#697]  INFO -- received: 2?
I, [2012-04-16 10:01:38#697]  INFO -- send: <po_botesttag1?
testtag1?04-16 10:01:38#697]  INFO -- received:

Also the simple_producer.rb returns some strange stuff:

I, [2012-04-16 10:02:32#700]  INFO -- received: ?

?
 capabilitiesF  copyrightS$Copyright (C) 2007-2011 VMware, Inc.
                                                               informationS5Licensed under the MPL.  See http://www.rabbitmq.complatformS
Erlang/OTPproductRabbitMQversionS2.7.1PLAIN AMQPLAINen_US?
I, [2012-04-16 10:02:32#700]  INFO -- send: ?

platformSRubyproductSBunny
                          informationS!http://github.com/ruby-amqp/bunnyversionS0.7.AMQPLAIN#LOGINSguesPASSWORDSguesten_US?
I, [2012-04-16 10:02:32#700]  INFO -- received: 

?
I, [2012-04-16 10:02:32#700]  INFO -- send: 

?
I, [2012-04-16 10:02:32#700]  INFO -- send: 
(/?
I, [2012-04-16 10:02:32#700]  INFO -- received: 
)?
I, [2012-04-16 10:02:32#700]  INFO -- send: 
?
I, [2012-04-16 10:02:32#700]  INFO -- received: 
                                                ?
I, [2012-04-16 10:02:32#700]  INFO -- send: 

/data?
I, [2012-04-16 10:02:32#700]  INFO -- received: 
                                                ?
I, [2012-04-16 10:02:32#700]  INFO -- send: (

sorting_roomdirect?
I, [2012-04-16 10:02:32#700]  INFO -- received: (
                                                 ?
I, [2012-04-16 10:02:32#700]  INFO -- send: <(
                                              sorting_roomfred?
I, [2012-04-16 10:02:32#700]  INFO -- send: )<,?application/octet-stream?
I, [2012-04-16 10:02:32#700]  INFO -- send: ,This is a message from the publisher?
I, [2012-04-16 10:02:32#700]  INFO -- send: (?bye?
I, [2012-04-16 10:02:32#700]  INFO -- received: )?
I, [2012-04-16 10:02:32#700]  INFO -- send: 
<?Goodbye?
I, [2012-04-16 10:02:32#700]  INFO -- received: 
=?

And if the simple_consumer.rb receives a message from the publisher, it fails with

simple_consumer.rb:51:in `block in <main>': undefined method `subscription' for #<Bunny::Queue:0x00000100877520> (NoMethodError)
    from /Users/23tux/.rvm/gems/ruby-1.9.3-p125/gems/bunny-0.7.9/lib/qrack/subscription.rb:81:in `call'
    from /Users/23tux/.rvm/gems/ruby-1.9.3-p125/gems/bunny-0.7.9/lib/qrack/subscription.rb:81:in `block in start'
    from /Users/23tux/.rvm/gems/ruby-1.9.3-p125/gems/bunny-0.7.9/lib/qrack/subscription.rb:56:in `loop'
    from /Users/23tux/.rvm/gems/ruby-1.9.3-p125/gems/bunny-0.7.9/lib/qrack/subscription.rb:56:in `start'
    from /Users/23tux/.rvm/gems/ruby-1.9.3-p125/gems/bunny-0.7.9/lib/bunny/queue08.rb:311:in `subscribe'
    from simple_consumer.rb:50:in `<main>'

Maybe someone can help,
thx

@gthiruva

I ran into that issue too playing with that piece of code ...

Instead of q.subscription you need to call q.default_consumer:

  puts "#{q.default_consumer.message_count}: #{msg[:payload]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.