{"id":46923,"library":"amqp-queue","title":"amqp-queue","description":"AMQP-based job queue with Redis-backed job status tracking (inactive, active, complete, error, progress). Current version 1.2.4, weekly releases. Differentiators: integrates AMQP for message routing/persistence while using Redis solely for monitoring job states across queues. Supports lightweight mode to skip monitoring for high-throughput jobs. Good for simple distributed job processing with visibility into job lifecycle.","status":"active","version":"1.2.4","language":"javascript","source_language":"en","source_url":"https://github.com/gongxiancao/amqp-queue","tags":["javascript"],"install":[{"cmd":"npm install amqp-queue","lang":"bash","label":"npm"},{"cmd":"yarn add amqp-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add amqp-queue","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"AMQP protocol client for RabbitMQ messaging","package":"amqplib","optional":false},{"reason":"Redis client for job status storage","package":"redis","optional":false}],"imports":[{"note":"ESM-only since v1.0, default export not available","wrong":"const Queue = require('amqp-queue').Queue","symbol":"Queue","correct":"import { Queue } from 'amqp-queue'"},{"note":"Must use named import","wrong":"import Queue from 'amqp-queue'","symbol":"Queue","correct":"import { Queue } from 'amqp-queue'"},{"note":"TypeScript types included, import Job for type annotations","wrong":"const { Job } = require('amqp-queue')","symbol":"Job","correct":"import { Job } from 'amqp-queue'"}],"quickstart":{"code":"import { Queue } from 'amqp-queue';\nimport { connect } from 'amqplib';\nimport { createClient } from 'redis';\n\nasync function main() {\n  const amqpConn = await connect(process.env.AMQP_URL ?? 'amqp://localhost');\n  const redisClient = createClient({ url: process.env.REDIS_URL ?? 'redis://localhost:6379' });\n  await redisClient.connect();\n\n  const queue = new Queue({ amqp: amqpConn, redis: redisClient });\n  await queue.setup({ mainQueue: 'tasks' });\n\n  queue.process(async (job) => {\n    console.log(`Processing job ${job.id}: ${JSON.stringify(job.data)}`);\n    job.progress(50);\n    return { result: 'done' };\n  });\n\n  const job = await queue.create({ task: 'example' });\n  console.log(`Created job ${job.id}`);\n\n  queue.on('complete', (job) => {\n    console.log(`Job ${job.id} completed`);\n  });\n\n  queue.on('error', (job, err) => {\n    console.error(`Job ${job.id} failed: ${err.message}`);\n  });\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Sets up AMQP queue and Redis client, creates a job, processes it with progress tracking, and handles complete/error events."},"warnings":[{"fix":"Ensure lightweight:true is only used when monitoring is not needed, or omit to track status.","message":"Job status in Redis is only updated for non-lightweight jobs; lightweight jobs bypass Redis entirely, making them unmonitorable.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace 'redis' with 'redisClient' in Queue constructor options.","message":"The constructor option 'redis' was deprecated in v1.1.0; use 'redisClient' instead.","severity":"deprecated","affected_versions":">=1.1.0"},{"fix":"Change queue.setup('myqueue') to queue.setup({ mainQueue: 'myqueue' }).","message":"In v1.2.0, the 'setup' method no longer accepts a queue name string; it requires an options object with 'mainQueue' property.","severity":"breaking","affected_versions":">=1.2.0"},{"fix":"Only call job.progress() inside the process handler.","message":"The 'progress' method on Job objects is only available after the job has started processing; calling it before yields no effect.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always await amqpConn.connect() and redisClient.connect() before new Queue(...).","message":"AMQP connection and Redis client must be connected before instantiating Queue; otherwise setup will fail with a connection error.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.2.4':23 'across':40 'activ':17 'amqp':2,5,28 'amqp-bas':4 'amqp-queu':1 'back':12 'base':6 'complet':18 'current':21 'differenti':26 'distribut':56 'error':19 'good':53 'high':50 'high-throughput':49 'inact':16 'integr':27 'javascript':64 'job':7,13,38,52,57,62 'lifecycl':63 'lightweight':43 'messag':30 'mode':44 'monitor':37,47 'process':58 'progress':20 'queue':3,8,41 'redi':11,34 'redis-back':10 'releas':25 'routing/persistence':31 'simpl':55 'skip':46 'sole':35 'state':39 'status':14 'support':42 'throughput':51 'track':15 'use':33 'version':22 'visibl':60 'week':24","created_at":"2026-06-07T16:48:35.472290+00:00","updated_at":"2026-06-07T16:48:35.472290+00:00","problems":[{"fix":"Use `import { Queue } from 'amqp-queue'` instead of `import Queue from 'amqp-queue'`.","cause":"Imported default export instead of named export.","error":"TypeError: queue.setup is not a function"},{"fix":"Await redisClient.connect() before creating Queue instance.","cause":"Queue instantiated before Redis client is connected.","error":"Error: Redis client is not connected"},{"fix":"Only use job.progress() inside the callback passed to queue.process().","cause":"Called progress outside of process handler.","error":"Error: job.progress is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/gongxiancao/amqp-queue#readme","github":"https://github.com/gongxiancao/amqp-queue","docs":null,"changelog":null,"pypi":null,"npm":"amqp-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}