No commit activity in last 3 years
No release in over 3 years
This gem makes it possible to send mails asynchronously using Resque by simply rewriting `SomeMailer.some_mail(ar_resource, 1234).deliver` to `SomeMailer.async_deliver.some_mail(ar_resource, 1234)`. Using ActiveRecord objects as arguments to mailers is still possible. This is achieved by storing the class name and the record id as arguments in the Resque queue which will be transformed back to records by the mailer job and passed along to the mailer.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 3.0.0.beta1

Runtime

< 5, >= 3
~> 1.0
 Project Readme

resque-async_deliver

Build Status Gem Version Dependency Status Code Climate Bitdeli Badge

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.

The jobs will be added to Resque in the mail queue.

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