Class: Jets::Job::Base

Inherits:
Lambda::Functions show all
Includes:
Dsl
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 inherited from Lambda::Functions

inherited, #initialize, subclasses

Methods included from Lambda::Dsl

add_custom_resource_extensions, included, #lambda_functions

Constructor Details

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

Class Method Details

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



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

def perform_later(meth, event={}, context={})
  function_name = "#{self.to_s.underscore}-#{meth}"
  call = Jets::Commands::Call.new(function_name, JSON.dump(event), invocation_type: "Event")
  call.run
end

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



18
19
20
# File 'lib/jets/job/base.rb', line 18

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

.process(event, context, meth) ⇒ Object



13
14
15
16
# File 'lib/jets/job/base.rb', line 13

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