lambdakiq 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6c7543a7f0f98a903e576b54cf791eb6efa83336b97a056bc4cce771634b04b
4
- data.tar.gz: e03956eb1543b0c5f5576aee3dd007e62567be052059aa166e5c28efdefdd5af
3
+ metadata.gz: 84d147fdbb851da5e7e6ebace4cd2eb5a00ae53d3bd0d36981d9cb90c93bac5b
4
+ data.tar.gz: 534d3f92cde56e7462202ebfd0b828039974d37792ee19d4c30b64ea0e901d61
5
5
  SHA512:
6
- metadata.gz: 20af5bc0de3846af919e8593187b180c78f3a04a953983529e0f0bdb73d6adb411e43d1e06c87bc31777f53e513cb2812ea703522a21fefc87a81cf46bd1c5ce
7
- data.tar.gz: 978de57e0ec0c92019b1e5ff2946eb9447e2182886d61e68392ce999162317281ad96c58c216e4f00f4b23e77fb5dea16b3f5259ed95c66f1b498c27008f72e9
6
+ metadata.gz: 6cff69c86fae5f46a63cfbd7ee6290fb8aa472a6dc1377424df1cf8daf17ca96c373a87577c4f50ebaf081d8c9b13421e032f8b71b314cbd4135ec2ca7ca7dfe
7
+ data.tar.gz: bed7c2407983c15b2ed48ba63362afe7b7a305c7415ec0deb533e25928ea805b8b5c8ad91bbeee4b51a7d3b69008e4854910b9093f392f454fdb78c8e8550db6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  See this http://keepachangelog.com link for information on how we want this documented formatted.
4
4
 
5
+ ## v2.2.0
6
+
7
+ ### Added
8
+
9
+ - Simple `Lambdakiq.cmd` to be used with `ImageConfig.Command`.
10
+
5
11
  ## v2.1.0
6
12
 
7
13
  #### Fixed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lambdakiq (2.1.0)
4
+ lambdakiq (2.2.0)
5
5
  activejob
6
6
  aws-sdk-sqs
7
7
  concurrent-ruby
data/README.md CHANGED
@@ -56,21 +56,7 @@ ActionMailer::MailDeliveryJob.include Lambdakiq::Worker
56
56
  ActionMailer::MailDeliveryJob.queue_as ENV['JOBS_QUEUE_NAME']
57
57
  ```
58
58
 
59
- The same Docker image will be used for both your `web` and `jobs` functions (example setup in following sections) which means the same `app.rb` handler would be used. The [Lamby](https://lamby.custominktech.com) gem automatically detects if Lambdakiq is being used so the following handler works as is.
60
-
61
- ```ruby
62
- def handler(event:, context:)
63
- Lamby.handler $app, event, context
64
- end
65
- ```
66
-
67
- You can use the Lambdakiq handler directly in cases where your handler is a different method. Likewise there is a `Lambdakiq.jobs?(event)` helper function which returns true if the `messageAttributes` has a `lambdakiq` attribute.
68
-
69
- ```ruby
70
- def jobs_handler(event:, context:)
71
- Lambdakiq.handler(event)
72
- end
73
- ```
59
+ The same Docker image will be used for both your `web` and `jobs` functions (example setup in following sections). The [Lamby](https://lamby.custominktech.com) gem can automatically can detect if Lambdakiq is present when using the newer `Lamby.cmd` or older lower `Lamby.handler` method. That said, please take a look at the `JobsLambda` in the following section and how `ImageConfig` is used as the golden path for sharing containers.
74
60
 
75
61
  ### SQS Resources
76
62
 
@@ -146,6 +132,8 @@ JobsLambda:
146
132
  BatchSize: 1
147
133
  FunctionResponseTypes:
148
134
  - ReportBatchItemFailures
135
+ ImageConfig:
136
+ Command: ["config/environment.Lambdakiq.cmd"]
149
137
  MemorySize: 1792
150
138
  PackageType: Image
151
139
  Policies:
@@ -161,6 +149,7 @@ JobsLambda:
161
149
 
162
150
  Here are some key aspects of our `JobsLambda` resource above:
163
151
 
152
+ - We use the `ImageConfig.Command` to load your Rails env and invoke the `Lambdakiq.cmd` which calls the `Lambdakiq.handler` on your behalf.
164
153
  - The `Events` property uses the [SQS Type](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-function-sqs.html).
165
154
  - The [BatchSize](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-function-sqs.html#sam-function-sqs-batchsize) can be any number you like. Less means more Lambda concurrency, more means some jobs could take longer. The jobs function `Timeout` must be lower than the `JobsQueue`'s `VisibilityTimeout` property. When the batch size is one, the queue's visibility is generally one second more.
166
155
  - You must use `ReportBatchItemFailures` response types. Lambdakiq assumes we are [reporting batch item failures](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting). This is a new feature of SQS introduced in [November 2021](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting).
@@ -1,3 +1,3 @@
1
1
  module Lambdakiq
2
- VERSION = '2.1.0'
2
+ VERSION = '2.2.0'
3
3
  end
data/lib/lambdakiq.rb CHANGED
@@ -20,6 +20,10 @@ require 'lambdakiq/railtie'
20
20
 
21
21
  module Lambdakiq
22
22
 
23
+ def cmd(event:, context:)
24
+ handler(event)
25
+ end
26
+
23
27
  def handler(event)
24
28
  Job.handler(event)
25
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lambdakiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-12 00:00:00.000000000 Z
11
+ date: 2022-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob