Messaging Infrastructure
Queue Management with BullMQ
Overview
We use BullMQ for job queuing and processing, providing:
- Horizontal scaling capabilities
- Message replay and retry mechanisms
- Distributed job processing
- Redis as the backend storage
Queue Monitoring
BullBoard URLs
- Staging: https://bull-board-staging-abda.up.railway.app/
- Production: https://creative-warmth-production.up.railway.app/
Important Notes
- Adding a new queue requires a BullBoard service restart
- Jobs are created and processed using BullMQ
- Limitation:
- Consumer groups feature is NOT available (paid feature)
- 1 will be consumed once, meaning we CAN'T currently gave 2 separate process consuming the same message for two different tasks
Job Processing
Retry Mechanisms
- Retry configuration can be customized per processor
- Default retry strategies can be configured
- Supports backoff and custom error handling
Best Practices
- Design idempotent job processors
- Use appropriate retry and backoff strategies
- Monitor queue performance and job statuses
- Handle potential race conditions and duplicates
- Create types for Jobs inputs and outputs
Infrastructure Details
- Backend: Redis
- Queue Management: BullMQ
- Monitoring: BullBoard
Future Improvements
- Explore advanced consumer group strategies
- Enhance job monitoring and alerting
- Investigate more sophisticated retry mechanisms