Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Deliver mails asynchronously using Resque without explicitly creating a performable job.
tag: v1.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.rvmrc
Gemfile
README.md
Rakefile
resque-async_deliver.gemspec

README.md

resque-async_deliver

resque-async_deliver is a simple gem to send emails asynchronously using Resque without having to change much in your existing codebase.

Installing

In your Gemfile:

gem 'resque-async_deliver'

Usage

Whenever you want to asynchronously send an email, simply change

SomeMailer.some_mail(an_argument, another_argument).deliver

to this

SomeMailer.async_deliver.some_mail(an_argument, another_argument)

This will enqueue a job that will simply run

SomeMailer.some_mail(an_argument, another_argument).deliver

You don't have to change your mailers, even if they take ActiveRecord objects as arguments. Since all the arguments will be JSON encoded by Resque before storing them in Redis, ActiveRecord objects will be serialized as a hash containing the class and the id of the model. resque-async_deliver will then find the records and pass them to the mailer.

Details

Tested on ruby 1.8.7 and 1.9.2.

Contributing

  1. Fork
  2. Create a topic branch
  3. Push to your branch
  4. Send a pull request

Author

Philipe Fatio
philipe.fatio@gmail.com
@fphilipe

Something went wrong with that request. Please try again.