简体   繁体   中英

Sidekiq with Rails 4 on Cloud9 Dev and Heroku Production

I am just not understanding how this works and need help. What I have done...

I have installed the sidekiq gem, I have added to the application.rb file

class Application < Rails::Application
  # ...
  config.active_job.queue_adapter = :sidekiq
end

I have created a Job(not sure if this was necessary as I am using ActionMailer only right now)

rails generate job Example

I have added #deliver_later to the actionmailer

if po_collection.empty? == false
      VendorSender.open_order_sender(user, vendor, po_collection).deliver_later
end

Am I missing anything here? How do I know it is working? Also, server log seems like it is working, but I am still waiting for emails to be sent.

2016-09-30T14:11:21.109402+00:00 app[worker.1]: 
2016-09-30T14:11:21.109509+00:00 app[worker.1]: [ActiveJob] [ActionMailer::DeliveryJob] [9da34b85-8695-4a0f-939f-c1614b141cb7] Performed ActionMailer::DeliveryJob from Sidekiq(mailers) in 1205.49ms
2016-09-30T14:11:21.110374+00:00 app[worker.1]: 3 TID-otddzp9gg ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper JID-3d86866a3e1d54bb0486c63c INFO: done: 3.415 sec
2016-09-30T14:11:21.111969+00:00 app[worker.1]: [ActiveJob] [ActionMailer::DeliveryJob] [e70249d4-81ff-4ca3-8e8a-d8534cd59370] 
2016-09-30T14:11:21.111970+00:00 app[worker.1]: Sent mail to private@private.com (939.1ms)
2016-09-30T14:11:21.112015+00:00 app[worker.1]: [ActiveJob] [ActionMailer::DeliveryJob] [e70249d4-81ff-4ca3-8e8a-d8534cd59370] Date: Fri, 30 Sep 2016 07:11:20 -0700

You have to run

bundle exec sidekiq

from the root of your rails project. You will see the jobs being processed in that window if it is working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM