Worker Configuration Example
This example makes use of worker configuration file in order to tell the worker to process two queues (critical
and mundane
) instead of the default
queue.
Note that the same can also be achieved through the command line, without using a config file.
Code
:concurrency: 2
:queues:
- critical
- default
- mundane
class Critical < Jobly::Job
options queue: 'critical'
def execute
logger.info "Running a critical job"
end
end
class Mundane < Jobly::Job
options queue: 'mundane'
def execute
logger.info "Running a mundane job"
end
end
# Procfile
web: jobly server
worker: jobly worker --config worker
Commands to Try
cd examples/worker-config
foreman start
jobly send Critical
jobly send Mundane