Search code examples
rubyredissinatrasidekiq

multiple sidekiq queue for an sinatra application


We have a Ruby on Sinatra application. We use sidekiq and redis for queue process.

We already implemented and using sidekiq that queues up jobs that does insertion into database. it works pretty fine till now.

Now I wanted to add another jobs which will read bulk data from database and export to csv file.

I donot want both this job to be in same queue instead is there possible to create different queue for these jobs in same application?

Please give some solution.


Solution

  • You probably need advanced queue options. Read about them here: https://github.com/mperham/sidekiq/wiki/Advanced-Options

    Create csv queue from command line (it can be done in config file as well):

    sidekiq -q csv -q default
    

    Then in your worker:

    class CSVWorker
      include Sidekiq::Worker
      sidekiq_options :queue => :csv
    
      # perform method
    end