module ActiveJob::Core

def arguments_serialized?

def arguments_serialized?
  defined?(@serialized_arguments) && @serialized_arguments
end

def deserialize(job_data)

end
end
retry_job(wait: 10)
raise exception if attempt_number > 5
rescue_from(Timeout::Error) do |exception|

end
self.attempt_number = job_data['attempt_number']
super
def deserialize(job_data)

end
super.merge('attempt_number' => attempt_number + 1)
def serialize

end
@attempt_number ||= 0
def attempt_number

attr_writer :attempt_number
class DeliverWebhookJob < ActiveJob::Base

==== Examples

returned from +serialize+
Attaches the stored job data to the current instance. Receives a hash
def deserialize(job_data)
  self.job_id               = job_data["job_id"]
  self.provider_job_id      = job_data["provider_job_id"]
  self.queue_name           = job_data["queue_name"]
  self.priority             = job_data["priority"]
  self.serialized_arguments = job_data["arguments"]
  self.executions           = job_data["executions"]
  self.exception_executions = job_data["exception_executions"]
  self.locale               = job_data["locale"] || I18n.locale.to_s
  self.timezone             = job_data["timezone"] || Time.zone&.name
  self.enqueued_at          = job_data["enqueued_at"]
end

def deserialize_arguments(serialized_args)

def deserialize_arguments(serialized_args)
  Arguments.deserialize(serialized_args)
end

def deserialize_arguments_if_needed

def deserialize_arguments_if_needed
  if arguments_serialized?
    @arguments = deserialize_arguments(@serialized_arguments)
    @serialized_arguments = nil
  end
end

def initialize(*arguments)

passed to the perform method.
Creates a new job instance. Takes the arguments that will be
def initialize(*arguments)
  @arguments  = arguments
  @job_id     = SecureRandom.uuid
  @queue_name = self.class.queue_name
  @priority   = self.class.priority
  @executions = 0
  @exception_executions = {}
  @timezone   = Time.zone&.name
end

def serialize

queuing adapter.
Returns a hash with the job data that can safely be passed to the
def serialize
  {
    "job_class"  => self.class.name,
    "job_id"     => job_id,
    "provider_job_id" => provider_job_id,
    "queue_name" => queue_name,
    "priority"   => priority,
    "arguments"  => serialize_arguments_if_needed(arguments),
    "executions" => executions,
    "exception_executions" => exception_executions,
    "locale"     => I18n.locale.to_s,
    "timezone"   => timezone,
    "enqueued_at" => Time.now.utc.iso8601
  }
end

def serialize_arguments(arguments)

def serialize_arguments(arguments)
  Arguments.serialize(arguments)
end

def serialize_arguments_if_needed(arguments)

def serialize_arguments_if_needed(arguments)
  if arguments_serialized?
    @serialized_arguments
  else
    serialize_arguments(arguments)
  end
end

def set(options = {}) # :nodoc:

:nodoc:
Configures the job with the given options.
def set(options = {}) # :nodoc:
  self.scheduled_at = options[:wait].seconds.from_now.to_f if options[:wait]
  self.scheduled_at = options[:wait_until].to_f if options[:wait_until]
  self.queue_name   = self.class.queue_name_from_part(options[:queue]) if options[:queue]
  self.priority     = options[:priority].to_i if options[:priority]
  self
end

def successfully_enqueued?

def successfully_enqueued?
  @successfully_enqueued
end