Namespaces Example

This example illustrates how to define jobs that are namespaced in modules.

It illustrates:

  1. How all jobs can be nested inside a specific module that is used as the default namespace for all jobs - see the config folder.

  2. How additional namespacing is done by putting some jobs under a nested module and (optionally, by convention) putting them inside a subfolder - see the jobs folder.

Code

config/jobly.rb
jobs/hello.rb
jobs/inner/hi.rb
Jobly.configure do |config|
config.jobs_namespace = 'Jobs'
end

Commands to Try

cd examples/namespaces
# Run the namespaced job that is found in the root namespace `Jobs`
jobly run Hello
# Run the nested job that is found in the root namespace `Jobs::Inner`
jobly run Inner::Hi