2

我通过运行使用shoryuken gem

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在生产中使用。我确保这些队列存在于

config/initializers/aws.rb使用

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

2 回答 2

2

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

对于开发中的队列,我强烈建议为每个开发人员创建一个用户 ( IAM ),并使用资源所需的权限"arn:aws:sqs:::${aws:username}-*",然后在 config 中- [<%= aws_user_name %>_queue_name, 1]

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

最后但同样重要的是,您还可以在运行时添加队列,检查这个

于 2017-02-27T20:03:38.813 回答
2

一种可能的解决方法是使用

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
于 2017-02-08T21:42:55.173 回答