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());

🎯 Results & Performance

FeaturePerformance
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!

0
Subscribe to my newsletter

Read articles from YANAMADALA RAJESH directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

YANAMADALA RAJESH
YANAMADALA RAJESH