Class: Jets::Event::Base
- Inherits:
-
Lambda::Functions
- Object
- Lambda::Functions
- Jets::Event::Base
- Extended by:
- Util::Logging
- Includes:
- Dsl, Helpers::KinesisEvent, Helpers::LogEvent, Helpers::S3Event, Helpers::SnsEvent, Helpers::SqsEvent, Jets::ExceptionReporting::Process
- Defined in:
- lib/jets/event/base.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Error
Instance Attribute Summary
Attributes inherited from Lambda::Functions
Class Method Summary collapse
- .handle(event, context, meth = :perform) ⇒ Object
- .handle_later(meth = :handle, event = {}, context = {}) ⇒ Object
- .handle_now(meth = :handle, event = {}, context = {}) ⇒ Object
Methods included from Util::Logging
Methods included from Helpers::SqsEvent
#sqs_events, #sqs_events?, #sqs_records
Methods included from Helpers::SnsEvent
Methods included from Helpers::S3Event
#s3_events, #s3_events?, #s3_files, #s3_objects, #s3_objects?
Methods included from Helpers::LogEvent
Methods included from Helpers::KinesisEvent
Methods inherited from Lambda::Functions
#_normalize_options, _prefixes, abstract!, inherited, #initialize, output_keys, subclasses
Methods included from Lambda::Dsl
Constructor Details
This class inherits a constructor from Jets::Lambda::Functions
Class Method Details
.handle(event, context, meth = :perform) ⇒ Object
25 26 27 28 |
# File 'lib/jets/event/base.rb', line 25 def handle(event, context, meth = :perform) runner = new(event, context, meth) runner.send(meth) end |
.handle_later(meth = :handle, event = {}, context = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/jets/event/base.rb', line 34 def handle_later(meth = :handle, event = {}, context = {}) function = "#{name.underscore}-#{meth}" # IE: "cool_event-handle" call = Jets::CLI::Call.new( function: function, event: JSON.dump(event), invocation_type: "Event" ) resp = begin call.invoke rescue Jets::CLI::Call::Error => e puts "ERROR: #{e.}".color(:red) puts "The stack may not be full deployed yet. Please check the stack and try again." return end unless resp.status_code == 202 raise Error, "Error calling Lambda function #{function} with invocation_type Event. status code: #{resp.status_code}" end resp end |
.handle_now(meth = :handle, event = {}, context = {}) ⇒ Object
30 31 32 |
# File 'lib/jets/event/base.rb', line 30 def handle_now(meth = :handle, event = {}, context = {}) handle(event, context, meth) end |