In the README, under Rails Mailers (https://github.com/collectiveidea/delayed_job/#rails-mailers), it states
You may also wish to consider using Active Job with Action Mailer which provides convenient .deliver_later syntax that forwards to Delayed Job under-the-hood.
This seems misleading to me, since it appears much of the Delayed Job functionality stops working. The statement "forwards to Delayed Job under-the-hood", makes it sound like DelayedJob is still in control. Can anyone confirm or clear up my misunderstanding?
I've been using DelayedJob for a long time and at some point started using deliver_later
based on that comment in the Readme.
I've just started using custom jobs and am also cleaning up my Rollbar integration. In the section on Hooks (https://github.com/collectiveidea/delayed_job#hooks), it states:
NOTE: If you are using ActiveJob these hooks are not available to your jobs. You will need to use ActiveJob's callbacks. You can find details here https://guides.rubyonrails.org/active_job_basics.html#callbacks
I have since experimented with this by throwing an exception inside of a mailer and noticed that mail sent with deliver_later
is not being reported to DelayedJob as a failed jobs or retried as configured in DelayedJob.
I've also noticed that Rollbar integration ties into the the DelayedJob :failure hook (https://github.com/rollbar/rollbar-gem/blob/master/lib/rollbar/plugins/delayed_job/plugin.rb).
By stating that Active Mailer "provides convenient .deliver_later syntax that forwards to Delayed Job under-the-hood", it wasn't clear that I was missing out on DelayedJob retry and failure logic...and Rollbar's DelayedJob integration.
I believe a warning should be added stating the caveats since many new users won't read/assimilate all of the details about custom jobs and hooks at first go.
Is the following true? "When using deliver_later
instead of delay
, the DelayedJob Hooks will not be called and thus DelayedJob's retry and failure handling will not be honored. In this case, when using deliver_later
, you should rely on ActiveJob exception handling."
Environment | |
---|---|
Rails | 5.2.8.1 |
DelayedJob | 4.1.11 |
Rollbar | 3.4.0 |