joe
joe

Reputation: 237

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.

Upvotes: 1

Views: 599

Answers (2)

dimakura
dimakura

Reputation: 7655

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

Upvotes: 2

cubicme
cubicme

Reputation: 31

take a look at sidekiq wiki: https://github.com/mperham/sidekiq/wiki/Advanced-Options

by default everything goes inside 'default' queue but you can specify a queue in your worker:

 sidekiq_options :queue => :file_queue

and to tell sidekiq to process your queue, you have to either declare it in configuration file:

:queues:
  - file_queue
  - default 

or pass it as argument to the sidekiq process: sidekiq -q file_queue

Upvotes: 1

Related Questions