|
|
@ -9,7 +9,7 @@ class Sylvilagus::Ch02::HelloWorldConsumer < DefaultConsumer
|
|
|
|
|
|
|
|
|
|
|
|
def main
|
|
|
|
def main
|
|
|
|
with_hello_world_conn do |conn,channel|
|
|
|
|
with_hello_world_conn do |conn,channel|
|
|
|
|
channel.basicConsume('hello-queue', false, new(channel))
|
|
|
|
channel.basic_consume('hello-queue', false, new(channel))
|
|
|
|
loop do
|
|
|
|
loop do
|
|
|
|
sleep 3
|
|
|
|
sleep 3
|
|
|
|
puts "Still waiting..."
|
|
|
|
puts "Still waiting..."
|
|
|
@ -19,10 +19,10 @@ class Sylvilagus::Ch02::HelloWorldConsumer < DefaultConsumer
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def handleDelivery(consumer_tag, envelope, properties, body)
|
|
|
|
def handleDelivery(consumer_tag, envelope, properties, body)
|
|
|
|
delivery_tag = envelope.getDeliveryTag
|
|
|
|
delivery_tag = envelope.get_delivery_tag
|
|
|
|
body_string = RubyString.bytes_to_string(body)
|
|
|
|
body_string = RubyString.bytes_to_string(body)
|
|
|
|
puts "Consumed #{body_string.inspect}"
|
|
|
|
puts "Consumed #{body_string.inspect}"
|
|
|
|
getChannel.basicAck(delivery_tag, false)
|
|
|
|
get_channel.basic_ack(delivery_tag, false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|