[英]send email with active job and sidekiq
I have an active job that sends an email 我有一份正在发送电子邮件的现役
class UpdateEmailJob < ActiveJob::Base
queue_as :default
def perform()
NotificationsMailer.create_client("mymail@gmail.com").deliver
end
end
Then on my code I call the perform later method 然后在我的代码上,我调用执行稍后的方法
UpdateEmailJob.perform_later
I am getting a message that the job has been Enqueued 我收到一条消息,说工作已经入队
[ActiveJob] Enqueued UpdateEmailJob (Job ID: 1a57232b-f6a8-4dc6-b612-8aca1b1dba2c) to Sidekiq(default)
But the email is not been send, how can I debug that ? 但是电子邮件尚未发送,我该如何调试? Is there a way to explore the queue ? 有没有办法探索队列? is there a way to force the worker to run all the queue jobs ? 有没有一种方法可以强制工人运行所有队列作业?
Do you have the sidekiq mailers queue running? 您是否正在运行sidekiq邮件队列? If not, run this: 如果没有,请运行以下命令:
bundle exec sidekiq -q default -q mailers
You can interact and debug enqueued jobs via the Sidekiq API . 您可以通过Sidekiq API交互和调试排队的作业。 Run rails c
, then: 运行rails c
,然后:
require 'sidekiq/api'
Sidekiq::Queue.new("mailers")
This provide all of the jobs currently enqueued in mailers. 这提供了邮递员当前排队的所有工作。 From there, look at the API docs for different ways to inspect them. 从那里,查看API文档以了解检查它们的不同方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.