librelist archives

« back to archive

resque and resque mailer

resque and resque mailer

Andrea Campolonghi
2011-09-12 @ 14:53
I am setting up resque and resque mailer but I cannot make it work.

I have included resque and resque mailer gems.
Added a resque.rb initializers:

require 'resque'
require 'resque/server'

rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'

resque_config = YAML.load_file(rails_root + '/config/resque.yml')
Resque.redis = resque_config[rails_env]


Added a resque_mailer initializers:

Resque::Mailer.excluded_environments = []

My mailers include :

include Resque::Mailer


I launch rails and no problem.
I add a mailer queue on cli (does exists a way to launch this 
programmatically ???)

VVERBOSE=1 QUEUE=mailer rake resque:work


Now when I call a mailer nothing happens. If I remove include 
Resque::Mailer form my mailer mail is sent and processed.
Looks like nothing is added to the mailer queue.
If I launch resque-web I see the worker but nothing in the queue and 
processed is always 0.

Btw if I add resque_spec and I run a test the test passes but again I do 
not get any mail and I do not see nothing processed in resque-web.
Is here resque_mailer that add the mailer queue to resque before starting 
the tests??

Am I missing soemthing???

Andrea Campolonghi