diff options
author | Terry Meacham <zv1n.fire@gmail.com> | 2014-09-23 15:51:44 -0500 |
---|---|---|
committer | Terry Meacham <zv1n.fire@gmail.com> | 2014-10-26 21:46:05 -0500 |
commit | 11ab04b11170253e96515c3ada6f2566b092533a (patch) | |
tree | ce22987d118a311aef27a734357314b9994f58ef /guides/source | |
parent | 85faea4b8320e728854838c6da97c9435de8869e (diff) | |
download | rails-11ab04b11170253e96515c3ada6f2566b092533a.tar.gz rails-11ab04b11170253e96515c3ada6f2566b092533a.tar.bz2 rails-11ab04b11170253e96515c3ada6f2566b092533a.zip |
Added queue_name_delimiter attribute.
- Added ActiveJob::Base#queue_name_delimiter to allow for
developers using ActiveJob to change the delimiter from the default
('_') to whatever else they may be using (e.g., '.', '-', ...).
- Updated source guide to include a blurb about the delimiter.
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/active_job_basics.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/guides/source/active_job_basics.md b/guides/source/active_job_basics.md index 9c34418fab..0f63a1c7e7 100644 --- a/guides/source/active_job_basics.md +++ b/guides/source/active_job_basics.md @@ -149,6 +149,29 @@ end # environment ``` +The default queue name prefix delimiter is '_'. This can be changed by setting +`config.active_job.queue_name_delimiter` in `application.rb`: + +```ruby +# config/application.rb +module YourApp + class Application < Rails::Application + config.active_job.queue_name_prefix = Rails.env + config.active_job.queue_name_delimiter = '.' + end +end + +# app/jobs/guests_cleanup.rb +class GuestsCleanupJob < ActiveJob::Base + queue_as :low_priority + #.... +end + +# Now your job will run on queue production.low_priority on your +# production environment and on staging.low_priority on your staging +# environment +``` + If you want more control on what queue a job will be run you can pass a :queue option to #set: |