【问题标题】:Environment specific shoryuken configuration环境特定的 shoryuken 配置
【发布时间】:2017-02-08 21:29:11
【问题描述】:

我通过运行使用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

【问题讨论】:

    标签: ruby-on-rails ruby yaml amazon-sqs shoryuken


    【解决方案1】:

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

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

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

    最后但同样重要的是,您还可以在运行时添加队列,请查看this

    【讨论】:

      【解决方案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
      

      【讨论】:

        猜你喜欢
        • 2013-08-16
        • 2014-04-25
        • 2017-12-08
        • 1970-01-01
        • 2014-09-07
        • 2014-03-03
        • 1970-01-01
        • 1970-01-01
        • 2013-07-13
        相关资源
        最近更新 更多