Skip to content

A lightweight, cross-language distributed task queue built on Redis with local memory support, designed for speed, scalability, and reliability. Perfect for handling background jobs, distributed processing, and asynchronous workflows across Python, Node.js, and other languages.

License

Notifications You must be signed in to change notification settings

Arjun-M/BridgeMQ

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŒ‰ BridgeMQ : Advanced Cross-Language Distributed Task Queue

Logo

Bridge-MQ is a next-generation task queue system that combines the best features of BullMQ while addressing its limitations and adding powerful new capabilities.

βœ… Key Features

⚑ Performance & Scalability

  • πŸ”„ FIFO & LIFO Ordering - Configurable queue ordering
  • ⚑ High Performance - Non-polling architecture, optimized for both micro and long-running tasks
  • ☁️ Serverless Ready - Supports Lambda, Vercel, and containerized environments
  • πŸ“¦ Bulk Operations - Efficient batch enqueue/delete
  • πŸ”’ Rate Limiting - Global and per-job rate controls

πŸ—„οΈ Storage & Backends

  • πŸ—ƒοΈ Multiple Storage Backends - Redis, File-based (LevelDB)
  • πŸ’Ύ File-Based Storage - No Redis required for local development
  • πŸ“ SQL Support - PostgreSQL and SQLite backends

⏱️ Scheduling & Execution

  • πŸ“… runAt Scheduling - Execute jobs at specific timestamps
  • ⏰ Advanced Scheduling - Delayed, absolute time (runAt), and cron-based jobs
  • πŸ” Smart Retries - Exponential, linear, or custom backoff strategies
  • 🧩 Job Flows - Parent-child dependencies and complex workflows
  • πŸ’€ Dead Letter Queue - Automatic handling of failed jobs

🌐 Cross-Language & Integration

  • 🌍 Cross-Language Support - Node.js, Python, Go SDKs
  • πŸ“Š Built-in Dashboard - Real-time monitoring and metrics
  • πŸ“ˆ Enhanced Monitoring - Prometheus metrics, OpenTelemetry integration
  • πŸ†“ 100% Open Source - All features available freely

πŸš€ Quick Start

Installation

npm install bridge-mq

Basic Usage

const { BridgeMQ } = require('bridge-mq');

// Using Redis (default)
const bridge = new BridgeMQ({
  storage: {
    type: 'redis',
    host: 'localhost',
    port: 6379
  }
});

// Or use file-based storage (no Redis needed!)
const bridgeLocal = new BridgeMQ({
  storage: {
    type: 'file',
    path: './data/queues'
  }
});

await bridge.connect();

// Add a job
const queue = bridge.queue('emails');
await queue.add('send-welcome', {
  to: '[email protected]',
  template: 'welcome'
});

// Process jobs
const worker = bridge.createWorker('emails', async (job) => {
  console.log('Processing:', job.data);
  await sendEmail(job.data);
  return { sent: true };
});

await worker.start();

πŸ“… Advanced Scheduling

Delayed Jobs (Run After)

// Run 2 hours from now
await queue.add('reminder', { userId: 123 }, {
  delay: 2 * 60 * 60 * 1000 // 2 hours
});

Absolute Time Jobs (Run At)

// Run at specific time
await queue.add('report', { reportId: 456 }, {
  runAt: new Date('2025-10-27T09:00:00Z')
});

// Or use timestamp
await queue.add('backup', {}, {
  runAt: Date.now() + (24 * 60 * 60 * 1000) // Tomorrow
});

Repeating Jobs (Cron)

// Every 6 hours
await queue.add('sync-data', {}, {
  repeat: {
    pattern: '0 */6 * * *',
    limit: 100 // Stop after 100 executions
  }
});

πŸŽ›οΈ Storage Backends

Redis

const bridge = new BridgeMQ({
  storage: {
    type: 'redis',
    host: 'localhost',
    port: 6379,
    password: 'secret'
  }
});

PostgreSQL

const bridge = new BridgeMQ({
  storage: {
    type: 'postgres',
    connectionString: 'postgresql://user:pass@localhost/bridgemq'
  }
});

SQLite

const bridge = new BridgeMQ({
  storage: {
    type: 'sqlite',
    filename: './bridge.db'
  }
});

File-Based (LevelDB)

const bridge = new BridgeMQ({
  storage: {
    type: 'file',
    path: './data/queues'
  }
});

πŸ”„ Job Flows & Dependencies

const flow = await bridge.createFlow('process-order');

await flow
  .add('validate-payment', { orderId: 123 })
  .then('reserve-inventory', { orderId: 123 })
  .then('send-confirmation', { orderId: 123 })
  .catch('refund-payment', { orderId: 123 })
  .execute();

🎯 Rate Limiting

const worker = bridge.createWorker('api-calls', handler, {
  rateLimit: {
    max: 100,        // 100 jobs
    duration: 60000  // per minute
  }
});

πŸ“Š Monitoring Dashboard

# Start built-in dashboard
bridgemq dashboard --port 3000

Visit http://localhost:3000 for real-time queue monitoring.

πŸ”§ CLI Commands

# List all queues
bridgemq list

# Show queue stats
bridgemq stats [queue]

# Real-time monitoring
bridgemq monitor

# Pause/Resume queues
bridgemq pause <queue>
bridgemq resume <queue>

# Clear jobs
bridgemq clear <queue> --completed --failed

# Start dashboard
bridgemq dashboard

# Export metrics
bridgemq metrics --format prometheus

πŸ“š Documentation

πŸ†š Bridge-MQ vs BullMQ

Feature Bridge-MQ BullMQ
Multiple Storage Backends βœ… Redis, SQL, File ❌ Redis only
runAt (Absolute Time) βœ… Yes ❌ No
FIFO/LIFO Ordering βœ… Yes ⚠️ Limited
Built-in Dashboard βœ… Yes ❌ Separate package
Dead Letter Queue βœ… Built-in ⚠️ Manual setup
Serverless Support βœ… Native ⚠️ Limited
File-based Storage βœ… Yes ❌ No
All Features Free βœ… Yes ⚠️ Some paid

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

πŸ“„ License

MIT - See LICENSE file

πŸ”— Links

About

A lightweight, cross-language distributed task queue built on Redis with local memory support, designed for speed, scalability, and reliability. Perfect for handling background jobs, distributed processing, and asynchronous workflows across Python, Node.js, and other languages.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published