Queue Management System

π Queue Management System Using Redis & BullMQ
Tech Stack: React.js | Node.js | Express.js | MySQL | Redis | BullMQ
π― Project Overview
Handling bulk email sending and large file uploads can be challenging. Our Queue Management System efficiently manages tasks like email dispatch, invalid email detection, retry mechanisms, and file uploads to Google Drive using Redis & BullMQ.
π₯ Key Features
π§ Bulk Email Processing
Supports 10,000+ emails per batch.
Uses BullMQ queues to manage email dispatch efficiently.
Prevents email server overload with rate limiting.
β Invalid & Blocklisted Mail Detection
Filters out invalid email addresses.
Maintains a blocklist to prevent sending to flagged emails.
π Retry Mechanism
Emails failing due to temporary issues are retried automatically.
Configurable retry limits and delay intervals.
π High Scalability with Redis & BullMQ
Uses Redis for fast message queuing.
Handles multiple jobs simultaneously, ensuring zero bottlenecks.
π Google Drive File Upload Integration
Uploads files up to 20GB directly to Google Drive.
Sends email with the Google Drive link instead of bulky attachments.
π Queue Monitoring Dashboard
Real-time job tracking with Bull Board UI.
Displays pending, in-progress, failed, and completed jobs.
βοΈ How It Works?
1οΈβ£ Setting Up Redis & BullMQ
const Queue = require('bullmq').Queue;
const redisOptions = { connection: { host: 'localhost', port: 6379 } };
const emailQueue = new Queue('emailQueue', redisOptions);
2οΈβ£ Adding Jobs to the Queue
emailQueue.add('sendEmail', {
recipient: 'user@example.com',
subject: 'Welcome!',
body: 'Thank you for signing up!'
});
3οΈβ£ Processing Jobs with Workers
const { Worker } = require('bullmq');
const worker = new Worker('emailQueue', async job => {
console.log(`Sending email to ${job.data.recipient}`);
await sendEmail(job.data); // Your email sending logic here
}, redisOptions);
4οΈβ£ Google Drive Upload Integration
const { google } = require('googleapis');
const drive = google.drive({ version: 'v3', auth });
async function uploadFile(filePath) {
const response = await drive.files.create({
requestBody: { name: 'uploaded-file.pdf', mimeType: 'application/pdf' },
media: { body: fs.createReadStream(filePath) }
});
return response.data.id;
}
π₯οΈ Queue Monitoring with Bull Board
- Install Bull Board UI:
npm install --save @bull-board/express
- Integrate into Express:
const { createBullBoard } = require('@bull-board/api');
const { ExpressAdapter } = require('@bull-board/express');
const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter');
const serverAdapter = new ExpressAdapter();
const { router } = createBullBoard([ new BullMQAdapter(emailQueue) ], { serverAdapter });
app.use('/admin/queues', serverAdapter.getRouter());
- Visit
http://localhost:3000/admin/queues
to monitor jobs!
π― Results & Performance
Feature | Performance |
Emails Sent | β 10,000+ emails per batch |
File Upload | β Supports files up to 20GB |
Processing Speed | β‘ 50+ emails per second |
Retry Mechanism | π Auto-retries failed emails |
Queue Monitoring | π Real-time job tracking |
π Why Use Queue Management?
β Efficiently handles bulk tasks π₯ β Reduces server overload π β Prevents email bounces & failures π§ β Optimized for large-scale applications β‘
Images:
π Conclusion
This Queue Management System streamlines email dispatch, automates retries, and integrates with Google Drive for seamless large file handling. Using BullMQ, Redis, and MySQL, this system ensures scalability, reliability, and performance.
π GitHub Repo: [Your Repository Link]
π© Want to build something similar? Letβs connect!
Subscribe to my newsletter
Read articles from YANAMADALA RAJESH directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
