You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+6-83Lines changed: 6 additions & 83 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,9 @@ Depending on how you want to retry failed messages, you must create topics to st
61
61
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`.
62
62
You can configure the total number of retry attempts with the `maxRetries` parameter.
63
63
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
+
64
67
For more information on configuring retries, see [Retry Topic Naming Strategies](#retry-topic-naming-strategies).
65
68
66
69
### Example Usage
@@ -205,36 +208,7 @@ Messages from the "retry" topics are then processed after a configurable delay.
205
208
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.
206
209
Here's a sequence diagram demonstrating the process:
207
210
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
@@ -260,33 +234,7 @@ To use this retry strategy, use the `RetryTopicNaming.ATTEMPT_BASED` `retryTopic
260
234
Here's a diagram of the message flow using this retry strategy.
261
235
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:
262
236
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)
@@ -307,32 +255,7 @@ To use this retry strategy, use the `RetryTopicNaming.DELAY_BASED` `retryTopicNa
307
255
308
256
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]`:
309
257
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)
0 commit comments