Hello Friends, I am back with new real programming problem. In general practice when we are working with sidekiq and delayed jobs. The problem occurs when we want custom queue with custom sidekiq workers. In this blog I am going to discuss the same with an example Here we go:
Create Sidekiq worker:
You can create sidekiq worker class if you want that the jobs will perform by this class. This is not mandatory. Create a worker class inside app/worker/worker_name.rb
.
Now you have a worker class that will pick the jobs from queue YOUR_QUEUE_NAME
.
Add queue name inside config/sidekiq.yml file:
Add YOUR_QUEUE_NAME
inside config/sidekiq.yml
file with weight. As like:
Sidekiq check high weight queue first.
Adding sidekiq process to the queue
If you want to add dedicated sidekiq worker instance to the particular queue, so that This worker instance can handle jobs from the queueYOUR_QUEUE_NAME
, then you can just add your Procfile
sidekiq -q YOUR_QUEUE_NAME
remove YOUR_QUEUE_NAME
from your config/sidekiq.yml
file, Otherwise other instance will also start executing jobs from YOUR_QUEUE_NAME
queue.
sidekiq -C config/sidekiq.yml
To start sidekiq process for other queues. Thanks for reading for more documentation, Please refer the link