Queue System
BullMQ-based queue system for handling profile and picture requests
Queue System
The Evolution API includes a BullMQ-based queue system for handling asynchronous operations like profile fetching and profile picture URL retrieval.
Overview
The queue system provides two main queues:
- fetchProfile - For handling profile fetch requests
- fetchProfilePictureUrl - For handling profile picture URL fetch requests
Configuration
The queues use Redis as the backing store. Configure Redis connection using environment variables:
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=your_password_if_neededEnsure your Redis instance is reachable from where the API is running and that authentication is configured if required by your environment.
Admin Dashboard
The BullMQ dashboard provides a visual interface for monitoring and managing queues.
Accessing the Dashboard
The dashboard is available at:
GET /admin/queuesAuthentication
The admin dashboard requires API key authentication using the same system as other Evolution API endpoints.
Headers:
apikey: YOUR_API_KEYFeatures
- Visual Queue Management: Monitor job status, retry failed jobs, and view queue statistics
- Real-time Updates: Live updates of queue status and job progress
- Job Retry Logic: Automatic retry with exponential backoff (3 attempts, starting at 2 seconds)
- Error Handling: Comprehensive error logging and monitoring
Queue Workers
The system includes placeholder workers for both queues. These workers are automatically initialized when the application starts and are ready for custom business logic implementation.
Worker Configuration
- Retry Attempts: 3 attempts per job
- Backoff Strategy: Exponential backoff starting at 2 seconds
- Connection: Uses the same Redis configuration as the queues
The default workers are placeholders. You should implement your domain-specific logic for processing jobs in each queue.
Implementation Notes
- The queue service is automatically initialized during application startup
- Workers are placeholder implementations - actual business logic needs to be added
- The system is designed for horizontal scaling with Redis as the backing store
- All queue operations are logged for monitoring and debugging
Next Steps
To fully implement the queue system:
- Add actual fetchProfile logic in the worker
- Add actual fetchProfilePictureUrl logic in the worker
- Implement proper error handling for specific use cases
- Add monitoring and alerting for failed jobs
- Consider adding job scheduling if needed
Related
- See Chats & Contacts
- Learn Managing Groups
- Review Sending Messages