I'm trying to use delayed_jobs (background workers) to process my incoming email.
class EmailProcessor
def initialize(email)
@raw_html = email.raw_html
@subject = email.subject
end
def process
do something with @raw_html & @subject
end
handle_asynchronously :process, :priority => 20
end
The problem is I can't pass instance variables (@raw_html & @subject) into delayed jobs. Delayed jobs requests that I save data into the model to be retrieved in the background task, but I would prefer to have a background worker complete the entire task (including saving the record).
Any thoughts?