queue-processor

Create BullMQ queue processors and services with session propagation and retry behavior.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/Zoppy-crm/.github --skill queue-processor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: queue-processor
Source: https://github.com/Zoppy-crm/.github/tree/main/skills/backend/queue-processor
Command: npx skills add https://github.com/Zoppy-crm/.github --skill queue-processor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide removes guesswork and prevents common mistakes when adding BullMQ queue processors and QueueServices to zoppy-api by documenting required session propagation, locking patterns, registration rules, and logging/retry expectations so background jobs run correctly and reliably.

Core Features & Use Cases

  • Create a Request-scoped QueueService that enqueues jobs with standardized QueueEnum and QueueJobEnum values and uses centralized enqueue helpers and retry presets.
  • Implement processors by extending QueueProcessorBase for normal jobs or ProviderQueueProcessorBase for exclusive per-company/provider processing with Redis locks and expiration.
  • Ensure correct session propagation by calling setSession(job) at the start of process, configure concurrency and lockDuration, use structured logging and error re-throwing for retries, and register processors in exactly one pipeline module to avoid duplicate consumption.
  • Common use cases: asynchronous provider syncs, message sending pipelines (WhatsApp/SMS/email), workflow execution steps, campaign processing, and general background tasks.

Quick Start

Create a Request-scoped QueueService and a Processor that calls await this.setSession(job) first, configures concurrency and lockDuration, uses the appropriate QueueJobEnum and QueueEnum, and registers the queue and processor in the correct module so jobs process reliably.

Frequently Asked Questions about queue-processor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I propagate session context in BullMQ background jobs?

To propagate session context in BullMQ background jobs, call `await this.setSession(job)` at the start of the processor's process method. This ensures the job executes with the correct request-scoped session data and retry behavior.

How do I prevent duplicate job consumption in NestJS BullMQ processors?

To prevent duplicate job consumption in NestJS BullMQ processors, register each queue processor in exactly one pipeline module. This single-module registration rule stops multiple consumers from processing the same background job concurrently.

When do I need Redis locks for BullMQ queue processing?

You need Redis locks for BullMQ queue processing when extending `ProviderQueueProcessorBase` to handle exclusive per-company or per-provider jobs. Configuring `lockDuration` ensures jobs expire correctly and prevents overlapping exclusive processing.

What's the best way to configure concurrency and retries for BullMQ processors?

The best way to configure concurrency and retries for BullMQ processors is to extend `QueueProcessorBase`, use centralized enqueue helpers with retry presets, and re-throw errors after structured logging to trigger automatic BullMQ retry behavior.

Can I use BullMQ queue processors for asynchronous provider syncs and message pipelines?

Yes, you can use BullMQ queue processors for asynchronous provider syncs, message sending pipelines like WhatsApp or SMS, workflow execution steps, and campaign processing by creating standardized QueueService and Processor implementations.

Why are my BullMQ background jobs failing to execute with the correct session?

BullMQ background jobs fail to execute with the correct session when `setSession(job)` is not called at the beginning of the process method. Always invoke this first to establish proper session propagation before processing logic.