Task 2-1: Document và Define DLQ Policy
Phase: 2 - DLQ & Error Handling Priority: Medium Depends on: Không có Reference: docs/BountyHunter-Backend/details/feature-prize-allocation/SPEC.md
Background
Khi listener throw exception, ActiveMQ sẽ redeliver message. Sau N lần fail, message vào DLQ. Hiện tại không có policy rõ ràng: bao nhiêu lần retry? TTL của DLQ message? Action khi message ở DLQ?
Tasks
DI Note: DLQ policy được cấu hình tại ActiveMQ broker level (XML config hoặc broker properties) — không phải Spring application code. Xác định deployment type: embedded ActiveMQ (cấu hình trong
application.yaml), standalone ActiveMQ broker (editactivemq.xml), hoặc cloud-managed MQ. Tìm broker config:grep -rn "activemq\|broker" */src/main/resources/.
- [ ] Xác nhận cấu hình redelivery hiện tại trong ActiveMQ broker config
- [ ] Define policy per queue type:
| Queue type | Max retries | Retry delay | DLQ action |
|---|---|---|---|
| PRIZE | 3 | 5s | Alert + manual review |
| PRIZE_FOR_STREAMER | 3 | 5s | Alert + manual review |
| UNLIMITED | 5 | 2s | Alert + auto-skip |
| MISSION | 3 | 5s | Alert |
| GACHA | 3 | 5s | Alert |
- [ ] Document policy tại một vị trí cụ thể (chọn 1): inline trong broker config, hoặc
batch/src/main/resources/dlq-policy.md - [ ] Implement trong ActiveMQ broker config (cú pháp theo broker type đang dùng):
<redeliveryPolicyMap> <redeliveryPolicyEntries> <redeliveryPolicy queue="queue-prize-allocation-PRIZE" maximumRedeliveries="3" redeliveryDelay="5000" useExponentialBackOff="true" backOffMultiplier="2"/> </redeliveryPolicyEntries> </redeliveryPolicyMap>
Verification / Acceptance Criteria
- [ ] DLQ policy được document với max retries, delay, và action per queue type
- [ ] ActiveMQ config reflect đúng policy (không dùng default unlimited redelivery)
- [ ] Khi listener throw exception liên tục → message vào DLQ sau đúng N retries (verify bằng test hoặc ActiveMQ admin console)
- [ ] DLQ message có original destination header (để task-2-2 phân loại được)
Files to Modify
- ActiveMQ broker config (location xác định sau khi audit)
batch/src/main/resources/dlq-policy.md(documentation)