【问题标题】:Does the default queue (inline runner) for ActiveJob support delaying the execution of a job?ActiveJob 的默认队列(内联运行器)是否支持延迟作业的执行?
【发布时间】:2015-03-23 00:44:16
【问题描述】:

我可以使用新的 rails 4.2 功能通过 ActiveJob 发送电子邮件

class InvitationModel < ActiveRecord::Base
    def send_invitation
        MyMailer.send_the_email(param1).deliver_later
    end
end

默认队列(内联运行器?)是否支持指定延迟,例如(伪代码)

MyMailer.send_the_email(param1).deliver_in(minutes: 5)

或者我需要另一个宝石吗?通过使用带有内联运行器的 ActiveJob,这封电子邮件的发送真的是异步的吗?

【问题讨论】:

    标签: ruby-on-rails-4 rails-activejob


    【解决方案1】:

    没有。内联运行器只是运行这项工作。为了能够异步运行作业,您需要使用队列后端。只有部分后端支持调度作业(延迟运行)。见此表http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-28
      • 1970-01-01
      • 2012-03-29
      • 1970-01-01
      • 2015-08-11
      相关资源
      最近更新 更多