Search code examples
ruby-on-railsamazon-web-servicesruby-on-rails-5ruby-2.3shoryuken

shoryuken error to `validate_queues': The specified queue(s)


I am using rails "Shoryuken" gem but I am getting errors for validation on queues on my development environment when I started rails server below is the error:-

gems/shoryuken-2.0.11/lib/shoryuken/environment_loader.rb:172:in `validate_queues': The specified queue(s) ["development_worker"] do not exist (ArgumentError)

I have used below settings:-

config/shoryuken.yml

aws:
  access_key_id: <%= ENV["SQS_IAM"] %>
  secret_access_key: <%= ENV["SQS_IAM_SECRET"] %>
  region: <%= ENV["SQS_IAM_REGION"] %>
concurrency: 25  # The number of allocated threads to process messages. Default 25
delay: 0         # The delay in seconds to pause a queue when it's empty. Default 0
queues:
  - ["<%= Rails.env %>_worker", 1]

initializers/shoryuken.rb

def parse_config(config_file)
  if File.exist?(config_file)
    YAML.load(ERB.new(IO.read(config_file)).result)
  else
    raise ArgumentError, "Config file #{config_file} does not exist"
  end
end

config = parse_config([Dir.pwd, 'config/shoryuken.yml'].join('/')).deep_symbolize_keys
Shoryuken::EnvironmentLoader.load(config)

I want the queue should be environment specific.


Solution

  • Ravindra, looking at the code of shoryuken, you are getting the error because you do not have created an SQS queue named development_worker, is that rigth?

    You will need to create one queue for each developer, because shoryuken will be running in the computers of each developer. If you don't do that, all shoryuken processes of each computer will be polling messages of the same queue. Imagine that there are two shoryuken processes, sh1 and sh2, that correspond to the dev1 and dev2 machine respectively. If the dev1 sends a SQS msg to the dev-queue, the sh2 proccess can be able to poll the message that the dev1 sent.

    If you wish to avoid to create the queues in AWS, you can take a look at this.