Jackson Henley
Jackson Henley

Reputation: 1531

Events for background processing like Resque?

Is there a existing way to have Resque return a result after a worker is done processing much like with evented callbacks in node.js?

Upvotes: 0

Views: 258

Answers (1)

Viren
Viren

Reputation: 5962

I think you want to look at resque after_perform hooks for job which will give you indication that job is processed / completed

something like this inside your job

class MyJob 
  @queue = :my_job

  def self.perform(*args)
    .... your perform code ...
  end

  def self.after_perform(*args)
    ... Write some code to setup a channel ..
  end 

end

This way the after_perform hook would be executed after the perform action is completed/processed signifying the completion of the job

What I would suggest is to set up a channel(either using pub/sub or list) between your application and resque job and subscribe/pull that data across to your application where you can identify based on payload that job was completed/processed

Hope this help

Thanks you

Upvotes: 1

Related Questions