Two threads in initializer on rails not working

Posted by Luccas on Server Fault See other posts from Server Fault or by Luccas
Published on 2012-09-09T04:40:23Z Indexed on 2012/09/09 9:39 UTC
Read the original article Hit count: 215

Initially I was using one thread to listen a queue from amazon and works perfectly.

enter image description here

aws.rb

Thread.new do
    my_queue = AWS::SQS::Queue.new(SQSADDR['my_queue'])
    my_queue.poll do |msg|
    ...

but now I appended another thread to listen another queue:

...    
Thread.new do
    my_another_queue = AWS::SQS::Queue.new(SQSADDR['my_another_queue'])
    my_another_queue.poll do |msg|
    ...

and now it seems to not work. Only the last one receives response...

What is going on?

© Server Fault or respective owner

Related posts about amazon-web-services

Related posts about ruby-on-rails