rubysidekiq

How can I create sidekiq queues with variable names at runtime?


I am trying to create queues with variable queue names.

queue_name = "guide_" + guide['id'].to_s

Sidekiq::Client.push({
    'class' => GuidePdfWorker,
    'queue' => queue_name,
    'args'  => [key],
    'backtrace' => true
})

I know that I am supposed to add them to config/sidekiq.yml, but I can't, since I don't know the value of queue_name.

When I log Sidekiq::Client.registered_queues() I can see my queues, but they are never processed.


Solution

  • The Sidekiq Dynamic Queues gem will probably help you.