This library is intended to let workers modularization.

It lets you load workers queue names from a given directory.

Let’s say you have some engines with workers in folder /my_engine/app/workers

You can place an initializer like follow in your engine so then the container app can collect all queues from engines:

## Engine

module MyApp

class Engine < ::Rails::Engine
  initializer 'my_app.wokers_path' do |app|
    WorkersLoader.resque_mailer!
    workers_path = MyApp::Engine.root.join('app', 'workers', 'my_app')
    WorkersLoader.add_path(workers_path)
  end
end

end

## Container App initializer

You can get the complete list of queues by doing the following:

WorkersLoader.load_workers! WorkersLoader.workers

With this list you can tell resque what queues to listen to.