2014-05-22 14:35:02 -04:00
|
|
|
require 'active_support/rescuable'
|
2014-05-22 13:35:45 -04:00
|
|
|
require 'active_job/arguments'
|
2014-05-20 18:26:19 -04:00
|
|
|
|
|
|
|
module ActiveJob
|
|
|
|
module Performing
|
2014-05-22 14:35:02 -04:00
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
include ActiveSupport::Rescuable
|
|
|
|
end
|
|
|
|
|
2014-05-22 13:33:23 -04:00
|
|
|
def perform_with_hooks(*serialized_args)
|
2014-05-22 13:35:45 -04:00
|
|
|
self.arguments = Arguments.deserialize(serialized_args)
|
2014-05-22 13:33:23 -04:00
|
|
|
|
|
|
|
run_callbacks :perform do
|
|
|
|
perform *arguments
|
|
|
|
end
|
2014-05-22 14:35:02 -04:00
|
|
|
rescue => exception
|
|
|
|
rescue_with_handler(exception)
|
2014-05-20 18:26:19 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def perform(*)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|