Class: Jets::Job::Base

Inherits:
Lambda::Functions show all
Includes:
Dsl, Helpers::KinesisEventHelper, Helpers::LogEventHelper, Helpers::S3EventHelper
Defined in:
lib/jets/job/base.rb

Direct Known Subclasses

ApplicationJob

Instance Attribute Summary

Attributes inherited from Lambda::Functions

#context, #event, #meth

Class Method Summary collapse

Methods included from Helpers::S3EventHelper

#s3_event, #s3_object

Methods included from Helpers::LogEventHelper

#log_event

Methods included from Helpers::KinesisEventHelper

#kinesis_data

Methods inherited from Lambda::Functions

inherited, #initialize, output_keys, subclasses

Methods included from Lambda::Dsl

#lambda_functions

Constructor Details

This class inherits a constructor from Jets::Lambda::Functions

Class Method Details

.perform_later(meth, event = {}, context = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/jets/job/base.rb', line 32

def perform_later(meth, event={}, context={})
  if on_lambda?
    function_name = "#{self.to_s.underscore}-#{meth}"
    call = Jets::Commands::Call.new(function_name, JSON.dump(event), invocation_type: "Event")
    call.run
  else
    puts "INFO: Not on AWS Lambda. In local mode perform_later executes the job with perform_now instead."
    perform_now(meth, event, context)
  end
end

.perform_now(meth, event = {}, context = {}) ⇒ Object



28
29
30
# File 'lib/jets/job/base.rb', line 28

def perform_now(meth, event={}, context={})
  new(event, context, meth).send(meth)
end

.process(event, context, meth) ⇒ Object



23
24
25
26
# File 'lib/jets/job/base.rb', line 23

def process(event, context, meth)
  job = new(event, context, meth)
  job.send(meth)
end