Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryandotsmith/queue_classic_example
An example of how to use queue_classic in a Rails3 app
https://github.com/ryandotsmith/queue_classic_example
Last synced: 3 months ago
JSON representation
An example of how to use queue_classic in a Rails3 app
- Host: GitHub
- URL: https://github.com/ryandotsmith/queue_classic_example
- Owner: ryandotsmith
- Created: 2011-05-22T23:25:03.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-11-28T16:59:29.000Z (about 13 years ago)
- Last Synced: 2023-04-12T18:26:56.624Z (almost 2 years ago)
- Language: Ruby
- Homepage: http://ryandotsmith.heroku.com/2011/09/queue_classic.html
- Size: 217 KB
- Stars: 12
- Watchers: 1
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Queue Classic Example
This simple Rails app shows off the features of QueueClassic. Specifically, an application that
users multiple queues with distinct workers. Some files to note:1. config/initializers/queue_classic.rb
2. db/migrate/20110519195855_add_queue_classic_tables.rb
3. app/models/user.rb
4. app/helpers/users_helper.rb
5. app/clock.rb
6. Procfile
7. Rakefile### Install
bundle
rake db:create
rake db:migrate
update DATABASE_URL in config/initializers/queue_classic.rb
rake qc:load_functions### Starting Workers
There are 3 queues in this app: Default, email_jobs, image_jobs.
We are only really using email_jobs and image_jobs, so we will attach workers on these queues.
QUEUE="image_jobs" rake jobs:work
QUEUE="email_jobs" rake jobs:workAll of this is encoded in our Procfile. You are using Procfile, right?
Now, to start these workers and our web process, execute `foreman start` in the root directory of the app.### Creating Jobs
foreman start (If you have not already done so.)
Visit /users/new
Click "create"
Watch output on the worker terminal windows### Scheduled Jobs
In app/clock.rb we setup a schedule for sending out welcome emails every day.
Queue Classic encourages you to handle your scheduling of work via a gem that
specializes in scheduling; **clockwork.** In our clock file, we schedule a
method call for each day. This method call will find all of the users who have
not received a welcome email and send each of those users a welcome email.