Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 1d80498

Browse files
Merge pull request #19 from shutterstock/beta
Promote beta release to general release
2 parents 6aee124 + 3fe7dd0 commit 1d80498

File tree

10 files changed

+11600
-4488
lines changed

10 files changed

+11600
-4488
lines changed

.commitlintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
extends:
2-
- "@commitlint/config-conventional"
2+
- "@vidavidorra/commitlint-config"

.github/dependabot.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ updates:
99
directory: "/" # Location of package manifests
1010
schedule:
1111
interval: "weekly"
12+
commit-message:
13+
prefix: "chore(deps): "
14+
include: scope

.github/workflows/ci.yaml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ name: Node.js CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
7+
- alpha
8+
- beta
69
pull_request:
7-
branches: [ main ]
8-
workflow_dispatch:
10+
branches:
11+
- main
12+
- alpha
13+
- beta
914

1015
jobs:
1116
build:
@@ -26,6 +31,8 @@ jobs:
2631
uses: actions/setup-node@v2
2732
with:
2833
node-version: ${{ matrix.node-version }}
34+
cache: npm
35+
- run: npm install -g npm
2936
- run: npm ci
3037
- run: npm run build
3138
- run: npm run lint
@@ -36,3 +43,17 @@ jobs:
3643
- name: Stop containers
3744
if: always()
3845
run: docker-compose -f "docker-compose.yml" down
46+
publish:
47+
needs:
48+
- build
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v3
53+
- run: npm ci
54+
- run: npm run build
55+
- name: Semantic Release
56+
uses: cycjimmy/semantic-release-action@v3
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/commitlint.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@ jobs:
88
- uses: actions/checkout@v3
99
with:
1010
fetch-depth: 0
11+
- uses: actions/setup-node@v2
12+
with:
13+
node-version: '18'
14+
- run: npm install
1115
- uses: wagoid/commitlint-github-action@v5
16+
with:
17+
configFile: .commitlintrc.yml
18+
env:
19+
NODE_PATH: ${{ github.workspace }}/node_modules

.releaserc.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
branches:
2+
- main
3+
- name: beta
4+
prerelease: true
5+
- name: alpha
6+
prerelease: true

README.md

Lines changed: 6 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ Depending on how you want to retry failed messages, you must create topics to st
6161
For example, if you want to wait 5 seconds for the first two retry attempts and 60 seconds for the third, create topics named `${consumerGroup}-retry-5s` and `${consumerGroup}-retry-60s`.
6262
You can configure the total number of retry attempts with the `maxRetries` parameter.
6363

64+
Remember, each of the topics used for facilitating retries should also have appropriate retention configurations that don't conflict with your retry times.
65+
For example, if your retry policy requires messages to be persisted for 24 hours before a retry is attempted, your retention policy should allow plenty of leeway for the retry message to be picked up.
66+
6467
For more information on configuring retries, see [Retry Topic Naming Strategies](#retry-topic-naming-strategies).
6568

6669
### Example Usage
@@ -205,36 +208,7 @@ Messages from the "retry" topics are then processed after a configurable delay.
205208
If a message continues to fail beyond a configurable maximum number of attempts, the message is published to a "dead letter" topic for manual inspection.
206209
Here's a sequence diagram demonstrating the process:
207210

208-
<!-- prettier-ignore -->
209-
```mermaid
210-
sequenceDiagram
211-
autonumber
212-
participant topicA as [Kafka]<br>Topic A
213-
participant cg as ConsumerGroupX
214-
participant retry as [Kafka]<br>ConsumerGroupX-Retry-N
215-
participant dead as [Kafka]<br>ConsumerGroupX-DeadLetter
216-
217-
activate cg
218-
loop
219-
topicA->>cg: fetch batch of messages
220-
retry->>cg: fetch batch of messages
221-
end
222-
loop each message
223-
opt From Retry Queue?
224-
note over cg: Pause consumption until message<br>is ready to process
225-
end
226-
opt Error During Processing?
227-
alt Retry?
228-
cg->>retry:
229-
else Fatal Error or Max Retries Reached?
230-
cg->>dead:
231-
end
232-
end
233-
cg->>topicA: commit offset
234-
cg->>retry: commit offset
235-
end
236-
deactivate cg
237-
```
211+
[![](https://mermaid.ink/img/pako:eNqFU9tO3DAQ_ZWRn9kfiNBWiAUeChUFHio1PMzak2A1vmCPESvEvzPOZUtTqZWi-HLOnDknjt-UDoZUozI9F_Kadhb7hK71AFg4-OL2lOoqYmKrbUTPwCFafQaY4edX7H7h4-k-bR_qJpytubqvvPPgc3GUrlIo8ceak4jTYSX3Z8XmrlI239aVhtD8u3AnjGtirinGVJrtCzKJsbocQoh1hDnUZrvVfQMdsX6CPdZ36MBRzthTnpij3f8TyZulAxAKPoOTSIgMlyk4GJPB90KFvkwQgA9iMLxQgtrjFksWv2OuyDZ4KJ7tsOjV0DaLKzQHSQExBS3IpDWbmPpdpBQS7EqyvofbiSbTY1sceLJz3AExIEnHxA0suzSIn0tkHGZJeW7wday1lGWUuGTWKvWwPokszo6TkTQdQyNxnbMs37TLxJ_w2cpf8KwiPX4fsDpR8iM4tEb-8LcKt4qfyFGrxIcy1GEZuFWtfxdqiUbKLozlkFTToYQ8UfUS3B-8Vg2nQgtpviUz6_0D4rQdnw)](https://mermaid.live/edit#pako:eNqFU9tO3DAQ_ZWRn9kfiNBWiAUeChUFHio1PMzak2A1vmCPESvEvzPOZUtTqZWi-HLOnDknjt-UDoZUozI9F_Kadhb7hK71AFg4-OL2lOoqYmKrbUTPwCFafQaY4edX7H7h4-k-bR_qJpytubqvvPPgc3GUrlIo8ceak4jTYSX3Z8XmrlI239aVhtD8u3AnjGtirinGVJrtCzKJsbocQoh1hDnUZrvVfQMdsX6CPdZ36MBRzthTnpij3f8TyZulAxAKPoOTSIgMlyk4GJPB90KFvkwQgA9iMLxQgtrjFksWv2OuyDZ4KJ7tsOjV0DaLKzQHSQExBS3IpDWbmPpdpBQS7EqyvofbiSbTY1sceLJz3AExIEnHxA0suzSIn0tkHGZJeW7wday1lGWUuGTWKvWwPokszo6TkTQdQyNxnbMs37TLxJ_w2cpf8KwiPX4fsDpR8iM4tEb-8LcKt4qfyFGrxIcy1GEZuFWtfxdqiUbKLozlkFTToYQ8UfUS3B-8Vg2nQgtpviUz6_0D4rQdnw)
238212

239213
### Retry Topic Naming Strategies
240214

@@ -260,33 +234,7 @@ To use this retry strategy, use the `RetryTopicNaming.ATTEMPT_BASED` `retryTopic
260234
Here's a diagram of the message flow using this retry strategy.
261235
This example uses a maximum of three retries with configured wait times of 5 seconds on the first two retries and a 60-second delay on the final attempt:
262236

263-
<!-- prettier-ignore -->
264-
```mermaid
265-
sequenceDiagram
266-
autonumber
267-
participant topicA as [Kafka]<br>Topic A
268-
participant cg as ConsumerGroupX
269-
participant retry1 as [Kafka]<br>ConsumerGroupX-Retry-1
270-
participant retry2 as [Kafka]<br>ConsumerGroupX-Retry-2
271-
participant retry3 as [Kafka]<br>ConsumerGroupX-Retry-3
272-
participant dead as [Kafka]<br>ConsumerGroupX-DeadLetter
273-
274-
topicA->>+cg:
275-
note over cg: Error processing message<br>(initial attempt)
276-
cg-)retry1:
277-
note over retry1: delay 5 seconds
278-
retry1 ->> cg:
279-
note over cg: Error processing message<br>(retry #35;1)
280-
cg -) retry2:
281-
note over retry2: delay 5 seconds
282-
retry2 ->> cg:
283-
note over cg: Error processing message<br>(retry #35;2)
284-
cg -) retry3:
285-
note over retry3: delay 60 seconds
286-
retry3 ->> cg:
287-
note over cg: Error processing essage<br>(retry #35;3)
288-
cg -X dead: Send to dead-letter topic
289-
```
237+
[![](https://mermaid.ink/img/pako:eNqtk0FLw0AQhf_KsF4sGrAJ9RClUGzxoCfroWA8THencTHZjZuNUEr_u7tJKmqaUsVT2OG9x8fkzYZxLYjFrKS3ihSnqcTUYJ4oAKysVlW-JONfAAUaK7ksUFmwupB8AljC0x2uXvH5emnGj34Ik66ap155o1VZ5WRuja6KRVdlyJr18Efmd1Pw4DXBsMccHmMOe8zRMeaoaxaE4rB16hT3ZK1fZONv1heMx2c8jaGZKW0J9DsZ8LOZMdpAYTSnspQqhdx9MSUffyqVtBIzQJeZF3bQBPA0GDQ77Ebu5oIyXMMISuJaibKRtYt3OPAnnNoPJ9HoaviJAsGg_Sc9MOEhmPA_YMIuTNQDE-1gLi_20ES_o9kLE32BWdSdiWFOSrgq1K8gqwvSNIOdM9eeHKVwl7nxxoTZF8opYY6BCVphldmEJWrrpFUh0NJMSKsNi1eYlXTO_PHO14qz2JqKdqL2ulvV9gPvpFhh)](https://mermaid.live/edit#pako:eNqtk0FLw0AQhf_KsF4sGrAJ9RClUGzxoCfroWA8THencTHZjZuNUEr_u7tJKmqaUsVT2OG9x8fkzYZxLYjFrKS3ihSnqcTUYJ4oAKysVlW-JONfAAUaK7ksUFmwupB8AljC0x2uXvH5emnGj34Ik66ap155o1VZ5WRuja6KRVdlyJr18Efmd1Pw4DXBsMccHmMOe8zRMeaoaxaE4rB16hT3ZK1fZONv1heMx2c8jaGZKW0J9DsZ8LOZMdpAYTSnspQqhdx9MSUffyqVtBIzQJeZF3bQBPA0GDQ77Ebu5oIyXMMISuJaibKRtYt3OPAnnNoPJ9HoaviJAsGg_Sc9MOEhmPA_YMIuTNQDE-1gLi_20ES_o9kLE32BWdSdiWFOSrgq1K8gqwvSNIOdM9eeHKVwl7nxxoTZF8opYY6BCVphldmEJWrrpFUh0NJMSKsNi1eYlXTO_PHO14qz2JqKdqL2ulvV9gPvpFhh)
290238

291239
#### Topics based on the configured delay
292240

@@ -307,32 +255,7 @@ To use this retry strategy, use the `RetryTopicNaming.DELAY_BASED` `retryTopicNa
307255

308256
Here's a sequence diagram of the various topics needing when using a `DELAY_BASED` naming strategy with the `retryDelays` parameter set to `[5, 5, 60]`:
309257

310-
<!-- prettier-ignore -->
311-
```mermaid
312-
sequenceDiagram
313-
autonumber
314-
participant topicA as [Kafka]<br>Topic A
315-
participant cg as ConsumerGroupX
316-
participant retry5s as [Kafka]<br>ConsumerGroupX-Retry-5s
317-
participant retry60s as [Kafka]<br>ConsumerGroupX-Retry-60s
318-
participant dead as [Kafka]<br>ConsumerGroupX-DeadLetter
319-
320-
topicA->>+cg:
321-
note over cg: Error processing message<br>(initial attempt)
322-
cg-)retry5s:
323-
note over retry5s: delay 5 seconds
324-
retry5s ->> cg:
325-
note over cg: Error processing message<br>(retry #35;1)
326-
cg -) retry5s:
327-
note over retry5s: delay 5 seconds
328-
retry5s ->> cg:
329-
note over cg: Error processing message<br>(retry #35;2)
330-
cg -) retry60s:
331-
note over retry60s: delay 60 seconds
332-
retry60s ->> cg:
333-
note over cg: Error processing essage<br>(retry #35;3)
334-
cg -X dead: Send to dead-letter topic
335-
```
258+
[![](https://mermaid.ink/img/pako:eNrFkzFPwzAQhf_KySxUNFKhSoeAKlW0YoCJMlQiDFf7GiwSO9gOUlX1v2MnaQWkRcDCFPn87unz5d2GcS2IJczSa0WK01RiZrBIFQBWTquqWJIJJ4ASjZNclqgcOF1KPgG08HiLqxd8ulqa8UMowqSr5llQXmtlq4LMjdFVueiqDDmzju0X089d0X0QRbE90j4a_Kjfy7oGglB83zz1ijtyLkyk6W_mEI3HZzxLoKkp7Qj0GxkItZkx2kBpNCdrpcqg8F_MKNifSiWdxBzQexal6zUGPIt67TC6nvsLQTmuIQZLXCvRvmc3Q08EfyKqDeBkGF-e72kg6sH_81x0efxvPAJU3zREo8EBpJCTXzEdRBp-QFrU-UlgTkr4WNSnKK_D0qSE9ZlPUoFS-HXbhMaUuWcqKGWegQlaYZW7lKVq66VVKdDRTEinDUtWmFvqs7CR87XiLHGmop2oXdlWtX0H7LVJmA)](https://mermaid.live/edit#pako:eNrFkzFPwzAQhf_KySxUNFKhSoeAKlW0YoCJMlQiDFf7GiwSO9gOUlX1v2MnaQWkRcDCFPn87unz5d2GcS2IJczSa0WK01RiZrBIFQBWTquqWJIJJ4ASjZNclqgcOF1KPgG08HiLqxd8ulqa8UMowqSr5llQXmtlq4LMjdFVueiqDDmzju0X089d0X0QRbE90j4a_Kjfy7oGglB83zz1ijtyLkyk6W_mEI3HZzxLoKkp7Qj0GxkItZkx2kBpNCdrpcqg8F_MKNifSiWdxBzQexal6zUGPIt67TC6nvsLQTmuIQZLXCvRvmc3Q08EfyKqDeBkGF-e72kg6sH_81x0efxvPAJU3zREo8EBpJCTXzEdRBp-QFrU-UlgTkr4WNSnKK_D0qSE9ZlPUoFS-HXbhMaUuWcqKGWegQlaYZW7lKVq66VVKdDRTEinDUtWmFvqs7CR87XiLHGmop2oXdlWtX0H7LVJmA)
336259

337260
## API
338261

0 commit comments

Comments
 (0)