Skip to content

Commit de161f2

Browse files
committed
Fix docs wiht Lambda handler.
1 parent 2f94b94 commit de161f2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ class ApplicationJob < ActiveJob::Base
4646
end
4747
```
4848

49+
The same Docker image will be used for both your `web` and `jobs` functions, setup below. However, we need to update your Lambda handler to handle these events. Open your `app.rb` file and update the `handler` method like so. If the event is an SQS event, Lambdakiq will handle it, otherwise it is a web request.
50+
51+
```ruby
52+
def handler(event:, context:)
53+
if Lambdakiq.jobs?(event)
54+
Lambdakiq.handler(event)
55+
else
56+
Lamby.handler $app, event, context, rack: :http
57+
end
58+
end
59+
```
60+
4961
### SQS Resources
5062

5163
Open up your project's SAM [`template.yaml`](https://lamby.custominktech.com/docs/anatomy#file-template-yaml) file and make the following additions and changes. First, we need to create your [SQS queues](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html) under the `Resources` section.

0 commit comments

Comments
 (0)