Skip to content

Conversation

@metaskills
Copy link
Member

@metaskills metaskills commented Apr 29, 2021

Eventually we want to move to this interface all the time in app.rb. Our goal is to reflect on the incoming event and do everything right as needed.

def handler(event:, context:)
  Lamby.handler $app, event, context
end

We are mature enough to know what HTTP events look like and can instantiate the proper Rack adapter as needed. This means we can also move away from code like this in the Lambdakiq gem.

def handler(event:, context:)
  if Lambdakiq.jobs?(event)
    Lambdakiq.handler(event)
  else
    Lamby.handler $app, event, context, rack: :http
  end
end

When it comes to EventBridge, we can not assume the details in the message knows now to instantiate model objects or invoke tasks. As such, we simply add a default proc that applications can customize. For example in application.rb:

Lamby.config.event_bridge_handler = lambda do |event, context|
   # ...
end

You can also set this configuration to Lamby.config.event_bridge_handler to false to disable this feature all together.

@metaskills metaskills merged commit e58ce87 into master Apr 29, 2021
@metaskills metaskills mentioned this pull request May 15, 2021
@metaskills metaskills deleted the EventBridgeSupport branch May 15, 2021 19:39
@metaskills metaskills mentioned this pull request Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants