Class: Aws::ActiveJob::SQS::JobRunner Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/active_job/sqs/job_runner.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

JOB_CLASS_NAME_PATTERN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

A job class name is an (optionally namespaced) constant path and nothing else. Names that cannot match this can never name a job class, so rejecting them keeps them out of the constant lookup.

/\A[A-Z]\w*(::[A-Z]\w*)*\z/.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ JobRunner

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of JobRunner.



23
24
25
26
27
# File 'lib/aws/active_job/sqs/job_runner.rb', line 23

def initialize(message)
  @job_data = ActiveSupport::JSON.load(message.data.body)
  @class_name = resolve_job_class(@job_data['job_class'])
  @id = @job_data['job_id']
end

Instance Attribute Details

#class_nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
# File 'lib/aws/active_job/sqs/job_runner.rb', line 21

def class_name
  @class_name
end

#idObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
# File 'lib/aws/active_job/sqs/job_runner.rb', line 21

def id
  @id
end

Instance Method Details

#exception_executions?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


33
34
35
36
# File 'lib/aws/active_job/sqs/job_runner.rb', line 33

def exception_executions?
  @job_data['exception_executions'] &&
    !@job_data['exception_executions'].empty?
end

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/aws/active_job/sqs/job_runner.rb', line 29

def run
  ::ActiveJob::Base.execute @job_data
end