diff options
author | Zachary Scott <e@zzak.io> | 2014-08-22 09:51:13 -0700 |
---|---|---|
committer | Zachary Scott <e@zzak.io> | 2014-08-22 09:51:13 -0700 |
commit | 4a5ea81b5ac09d382a94e3fb563a010d2c7f840d (patch) | |
tree | 6b8bd5c9fbf61729c296689a34451b659f7ec533 /guides | |
parent | 2602a49a8600ab52f807599bbd5b1f9c0be4214f (diff) | |
parent | 94a7a863d3bb462770bc8427837bf22148ef4e1a (diff) | |
download | rails-4a5ea81b5ac09d382a94e3fb563a010d2c7f840d.tar.gz rails-4a5ea81b5ac09d382a94e3fb563a010d2c7f840d.tar.bz2 rails-4a5ea81b5ac09d382a94e3fb563a010d2c7f840d.zip |
Merge pull request #16642 from cristianbica/aj-doc-queue-name-prefix
Active Job Guide: Example of config queue_name_prefix [ci skip]
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_job_basics.md | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/guides/source/active_job_basics.md b/guides/source/active_job_basics.md index 58e828d1b5..297a1834d1 100644 --- a/guides/source/active_job_basics.md +++ b/guides/source/active_job_basics.md @@ -150,8 +150,29 @@ class GuestsCleanupJob < ActiveJob::Base end ``` -NOTE: Make sure your queueing backend "listens" on your queue name. For some backends -you need to specify the queues to listen to. +Also you can prefix the queue name for all your jobs using +`config.active_job.queue_name_prefix` in `application.rb`: + +```ruby +# config/application.rb +module YourApp + class Application < Rails::Application + config.active_job.queue_name_prefix = Rails.env + 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 beta_low_priority on your beta environment +``` + +NOTE: Make sure your queueing backend "listens" on your queue name. For some +backends you need to specify the queues to listen to. Callbacks |