问题描述
如果我的“活动作业”未能达到设置的重试次数,我想发送一封带有警报的电子邮件,但是显然,由于该事件从未触发,因此该事件的订阅存在错误。这是我得到的:
class MyJob < ApplicationJob
queue_as :default
retry_on MyJobException,wait: 5.minutes,attempts: 3
ActiveSupport::Notifications.subscribe "retry_stopped.active_job" do |*args|
## THIS PART IS NEVER TRIGGERED
# email the team to let them job still Failed after 3 attempts
JobMailer.notify_on_job_failure(“MyJob Failed despite all retries!”).deliver
end
def perform(*args)
# job tasks
raise MyJobException if job_Failed
end
end
我找不到任何有关如何在代码内部正确使用“ retry_stopped.active_job”挂钩的示例。有什么想法我做错了吗?谢谢!!!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)