Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callbacks / Hooks #139

Closed
trinityXmontoya opened this issue May 21, 2017 · 2 comments
Closed

Callbacks / Hooks #139

trinityXmontoya opened this issue May 21, 2017 · 2 comments

Comments

@trinityXmontoya
Copy link

trinityXmontoya commented May 21, 2017

The Hooks section in the Delayed::Job Readme shows how to setup callbacks, but I cannot get it to work and wonder if there is additional configuration required when working with delayed_job_active_record vs the original gem?

versions: Rails 4.2.6, delayed_job_active_record 4.1.1

class CustomJob < ActiveJob::Base
  def perform(params)
    puts "I run successfully"
  end

  def success
    puts "but I never run"
  end

  def after
    puts "nor do i"
  end
end
@sumit08
Copy link

sumit08 commented Oct 11, 2017

I am also not able to use the hooks for delayed_job_active_record. Does anyone knows the configuration that we need to do to make this work ?

@albus522
Copy link
Member

You are using ActiveJob and that is hiding some important details from you. The most important being ActiveJob is running that job not DJ. ActiveJob creates a wrapper job behind the scenes. DJ only executes this wrapper job, everything else is within ActiveJob. You can find out more about ActiveJob callbacks here https://guides.rubyonrails.org/v4.2/active_job_basics.html#callbacks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants