AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Class: Aws::Rails::SqsActiveJob::JobRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/rails/sqs_active_job/job_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ JobRunner

Returns a new instance of JobRunner.



10
11
12
13
14
# File 'lib/aws/rails/sqs_active_job/job_runner.rb', line 10

def initialize(message)
  @job_data = Aws::Json.load(message.data.body)
  @class_name = @job_data['job_class'].constantize
  @id = @job_data['job_id']
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



8
9
10
# File 'lib/aws/rails/sqs_active_job/job_runner.rb', line 8

def class_name
  @class_name
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/aws/rails/sqs_active_job/job_runner.rb', line 8

def id
  @id
end

Instance Method Details

#runObject



16
17
18
# File 'lib/aws/rails/sqs_active_job/job_runner.rb', line 16

def run
  ActiveJob::Base.execute @job_data
end