From 11ab04b11170253e96515c3ada6f2566b092533a Mon Sep 17 00:00:00 2001 From: Terry Meacham Date: Tue, 23 Sep 2014 15:51:44 -0500 Subject: 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. --- guides/source/active_job_basics.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'guides/source') 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: -- cgit v1.2.3