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
This document provides a focused deep dive into how **Processing, Retry & Failure Orchestration** is implemented in my SpringQueuePro system.
5
+
This document provides a focused deep dive into how **Processing, Retry & Failure Orchestration** is implemented in the SpringQueuePro system.
6
6
7
7
While the **Task Domain & Persistence** deep dive explains how PostgreSQL enforces correctness and atomic state transitions, and the **Distributed Coordination & Redis Integration** deep dive explains how Redis provides safe mutual exclusion under concurrency, this document focuses on **what happens after a task has been claimed**:
8
8
@@ -28,7 +28,7 @@ This document explains and highlights:
28
28
- How manual requeueing is supported safely
29
29
- Steps taken to mirror production-grade retry semantics
30
30
31
-
**NOTE**: This document intentionally does **not** re-explain database claim semantics (`QUEUED → IN_PROGRESS`) or Redis lock mechanics. Those topics are covered in the *Task Domain & Persistence* and *Distributed Coordination & Redis Integration* deep dives. The focus here is strictly on **execution flow after claim, failure classification, and retry orchestration**.
31
+
**NOTE**: This document intentionally does **not** re-explain database claim semantics (`QUEUED → INPROGRESS`) or Redis lock mechanics. Those topics are covered in the *Task Domain & Persistence* and *Distributed Coordination & Redis Integration* deep dives. The focus here is strictly on **execution flow after claim, failure classification, and retry orchestration**.
32
32
33
33
---
34
34
@@ -43,6 +43,8 @@ This document explains and highlights:
43
43
-[Observability of Processing & Retry Behavior](#observability-of-processing--retry-behavior)
44
44
-[Steps Taken to Mimic Production Quality](#steps-taken-to-mimic-production-quality)
45
45
46
+
---
47
+
46
48
## Why Retry Orchestration Is Critical in SpringQueuePro
47
49
48
50
SpringQueuePro is designed as a concurrent, multi-worker task system where **tasks may legitimately fail** due to:
@@ -51,7 +53,7 @@ SpringQueuePro is designed as a concurrent, multi-worker task system where **tas
51
53
- deterministic failures (simulated via “fail absolute” handlers)
In a system like this, retry behavior cannot be an afterthought. If retries are poorly designed:
57
59
@@ -63,6 +65,8 @@ In a system like this, retry behavior cannot be an afterthought. If retries are
63
65
64
66
For these reasons, SpringQueuePro treats retries as a **first-class orchestration concern** and places retry logic in a single authoritative location: `ProcessingService`.
65
67
68
+
---
69
+
66
70
## Handlers vs Orchestration: Clear Responsibility Boundaries
-The state transition is enforced in the database (`FAILED → QUEUED`)
223
-
-Attempts are reset to 0 (to re-enable retry semantics cleanly)
224
-
-Cache is synchronized
225
-
-A`TaskCreatedEvent` is published
246
+
-only`FAILED` tasks are eligible
247
+
- state transition (`FAILED → QUEUED`) is enforced in the database
248
+
-attempts are reset to zero
249
+
-Redis cache is synchronized
250
+
-a`TaskCreatedEvent` is published
226
251
227
-
Publishing the event (rather than directly calling `enqueueById`) is deliberate: it ensures runtime submission happens only after the transaction commits, preventing “phantom execution” of tasks whose state hasn’t actually been persisted yet.
252
+
Publishing the event—rather than calling `enqueueById` directly—is deliberate. It ensures execution occurs only **after the transaction commits**, preventing execution of tasks whose state is not yet durable.
228
253
229
-
This mirrors real production systems where operational commands (manual retry) are handled through the same lifecycle mechanisms as normal execution.
254
+
This mirrors production systems where operational actions reuse the same lifecycle pathways as normal execution.
230
255
231
256
---
232
257
233
258
## Observability of Processing & Retry Behavior
234
259
235
-
SpringQueuePro makes processing and retry behavior explicitly visible through:
260
+
SpringQueuePro exposes processing and retry behavior explicitly via:
Retries re-enter the system through the same submission pipeline (`enqueueById`), ensuring:
335
+
Retries re-enter through the same submission pipeline (`enqueueById`), ensuring:
309
336
310
337
- consistent execution boundaries
311
338
- uniform observability
@@ -317,14 +344,14 @@ Retries re-enter the system through the same submission pipeline (`enqueueById`)
317
344
318
345
SpringQueuePro treats task processing as an orchestration problem, not a handler problem.
319
346
320
-
Handlers do work. Failures are persisted. Retries are policy-driven. Backoff is deliberate. Execution re-enters the pipeline through controlled scheduling.
347
+
Handlers execute work. Failures are persisted. Retries are policy-driven. Backoff is deliberate. Execution re-enters through controlled scheduling.
321
348
322
-
This design yields task execution behavior that is:
349
+
This yields processing behavior that is:
323
350
324
351
- deterministic
325
352
- scalable
326
353
- observable
327
-
- production-adjacent in its operational semantics
0 commit comments