自定义ActiveJob适配器不会处理邮件程序作业

时间:2015-09-11 14:42:27

标签: ruby-on-rails rails-activejob

我有一个我写的ActiveJob适配器,如下所示:

require 'aws-sdk-core'

module ActiveJob
  module QueueAdapters
    class SqsAdapter
      class << self
        def enqueue(job)
          sqs = Aws::SQS::Client.new(region: 'us-east-1')
          sqs.send_message(
            queue_url: ENV['SQS_QUEUE_URL'],
            message_body: MultiJson.dump(job.serialize)
          )
        end
      end

      class JobWrapper
        class << self
          def perform(job_data)
            ActiveJob::Base.execute job_data
          end
        end
      end
    end
  end
end

当我通过它运行邮件程序时(例如UserMailer.registration_email(user).deliver_now),我的日志输出如下所示:

  

处理工作e0f6afac-7b95-40c7-89d0-d9c63b808198错误的数量   参数(1 for 3+){“job_class”=&gt;“ActionMailer :: DeliveryJob”,   “JOB_ID”=&gt; “中e0f6afac-7b95-40c7-89d0-d9c63b808198”,   “queue_name”=&gt;“mailers”,“arguments”=&gt; [“UserMailer”,   “registration_email”,“deliver_now”,   {“_ aj_globalid”=&gt;“gid:// my-cms / RetailUser / 863”}],“locale”=&gt;“en”}

为什么我的适配器不喜欢邮件工作,我该如何解决呢?

0 个答案:

没有答案