Using the more explicit Java symbol access pattern

This commit is contained in:
Dan Buch 2012-12-02 20:28:07 -05:00
parent e1a07fadd9
commit 5228eba27e

View File

@ -1,9 +1,6 @@
require 'sylvilagus/ch02/hello_world' require 'sylvilagus/ch02/hello_world'
import com.rabbitmq.client.DefaultConsumer class Sylvilagus::Ch02::HelloWorldConsumer < Java::ComRabbitmqClient::DefaultConsumer
import org.jruby.RubyString
class Sylvilagus::Ch02::HelloWorldConsumer < DefaultConsumer
class << self class << self
include Sylvilagus::Ch02::HelloWorld::ClassMethods include Sylvilagus::Ch02::HelloWorld::ClassMethods
@ -27,7 +24,7 @@ class Sylvilagus::Ch02::HelloWorldConsumer < DefaultConsumer
end end
def handleDelivery(consumer_tag, envelope, properties, body) def handleDelivery(consumer_tag, envelope, properties, body)
body_string = RubyString.bytes_to_string(body) body_string = Java::OrgJruby::RubyString.bytes_to_string(body)
puts "Consumed #{body_string.inspect}" puts "Consumed #{body_string.inspect}"
channel.basic_ack(envelope.delivery_tag, false) channel.basic_ack(envelope.delivery_tag, false)