Skip to content

Task 2-1: Review và Chuẩn hóa DLQ Strategy cho Tất Cả Queues

Phase: 2 - Stability Priority: Medium Depends on: task-1-2 Reference: docs/BountyHunter-Backend/details/feature-batch-async-processing/SPEC.md

Background

Sau khi có DLQ alerting (task-1-2), cần chuẩn hóa DLQ policy cho tất cả queues: không chỉ prize-allocation mà còn matching, gacha, livestream.

Tasks

  • [ ] Kiểm tra redelivery config hiện tại của ActiveMQ broker (ActiveMQ Artemis)
  • [ ] Define policy đầy đủ theo bảng:
Queue group Max redeliveries Redelivery delay DLQ action
Prize allocation (PRIZE, FOR_STREAMER) 3 5s + exponential Alert HIGH
Prize allocation (UNLIMITED) 5 2s Alert MEDIUM
Matching queues 3 3s Alert HIGH (game impact)
Invitation 3 3s Alert MEDIUM
Gacha queues 3 5s Alert HIGH
Livestream gift 5 1s Alert LOW (non-critical)
Machine queues 3 3s Alert HIGH (game impact)
  • [ ] Apply config vào broker (ActiveMQ Artemis broker.xml hoặc application.yaml)
  • [ ] Create DLQ handling document: batch/docs/dlq-policy.md

Verification / Acceptance Criteria

  • [ ] batch/docs/dlq-policy.md is created and contains the full DLQ policy table with all queue groups
  • [ ] ActiveMQ broker config (Artemis broker.xml or application.yaml) reflects the redelivery settings from the policy table
  • [ ] After applying config, publishing a poison-pill message to a prize queue results in exactly 3 redelivery attempts before DLQ routing (verifiable in broker logs)
  • [ ] DLQ alerts are triggered at the correct severity level per queue group (HIGH / MEDIUM / LOW) as defined in the policy
  • [ ] No existing queue behavior is broken — healthy messages still process normally after config change

Files to Modify

  • ActiveMQ broker config
  • batch/docs/dlq-policy.md (new)