Playing with round-robin behavior

This commit is contained in:
Dan Buch 2012-11-27 00:11:56 -05:00
parent 10aa737d1d
commit b8d83c830c
2 changed files with 3 additions and 4 deletions

View File

@ -38,7 +38,7 @@ class Sylvilagus::Ch04::AddPointsConsumer
channel.exchange_declare( channel.exchange_declare(
'upload-pictures', 'fanout', false, true, false, nil 'upload-pictures', 'fanout', false, true, false, nil
) )
channel.queue_declare('add-points', false, true, false, nil) channel.queue_declare('add-points', false, false, false, nil)
channel.queue_bind('add-points', 'upload-pictures', '') channel.queue_bind('add-points', 'upload-pictures', '')
consumer = Consumer.new(channel) consumer = Consumer.new(channel)

View File

@ -40,13 +40,12 @@ class Sylvilagus::Ch04::ResizePictureConsumer
channel.exchange_declare( channel.exchange_declare(
'upload-pictures', 'fanout', false, true, false, nil 'upload-pictures', 'fanout', false, true, false, nil
) )
channel.queue_declare('resize-picture', false, true, false, nil) channel.queue_declare('resize-picture', false, false, false, nil)
channel.queue_bind('resize-picture', 'upload-pictures', '') channel.queue_bind('resize-picture', 'upload-pictures', '')
consumer = Consumer.new(channel) consumer = Consumer.new(channel)
puts "Consuming from 'upload-pictures' exchange" puts "Consuming from 'upload-pictures' exchange"
channel.basic_consume('resize-picture', false, channel.basic_consume('resize-picture', false, 'resize-picture-consumer',
"resize-picture-consumer-#{$$}-#{ENV['HOSTNAME']}",
false, false, nil, consumer) false, false, nil, consumer)
loop do loop do
break if consumer.done? break if consumer.done?