2017-02-08 58 views
0

我使用shoryuken gem运行环境的特定shoryuken配置

bundle exec shoryuken -R -C config/shoryuken.yml 

和shoryuken.yml是

concurrency: 25 
delay: 0 
queues: 
- [development_high, 30] 
- [development_mid, 6] 
- [development_low, 2] 

这工作得很好。但是,我想使用特定于环境的队列,例如在生产中使用production_high。 我要确保使用

%w(low mid high).each do |q| 
    sqs.create_queue(queue_name: Rails.env + '_' + q) 
end 

回答

1

我通常使用一个特定的配置shoryuken.dev.yml正在开发中。

对于发展中的队列中,我强烈建议创建每个开发人员用户(IAM),与the needed permissions的资源"arn:aws:sqs:::${aws:username}-*",然后在配置- [<%= aws_user_name %>_queue_name, 1]

如果您使用ActiveJob,请查看inline选项。可能是另一种选择。

最后但并非最不重要,您也可以在运行时添加队列,请检查this

0

一个解决办法可能在

config/initializers/aws.rb存在这些队列使用

concurrency: 25 
delay: 0 
queues: 
- [<%=ENV['RAILS_ENV']%>_high, 30] 
- [<%=ENV['RAILS_ENV']%>_mid,  6] 
- [<%=ENV['RAILS_ENV']%>_low,  2] 

,并开始shoryuken与

RAILS_ENV=development bundle exec shoryuken -R -C config/shoryuken.yml