NodeJS service that offloads expensive jobs to Bull (Redis-based queue) for background processing.
This repository is a demonstration of using background processing / message queues using BullMQ, a Redis-based queue for NodeJS. In this example we create message queues in Redis, write jobs into these queues, and attach workers to process those jobs. There are three container types in play;
redis-data/
) to ensure jobs live between container teardowns and restarts.These instructions assumes you already have docker
and docker compose
installed. The steps are as follows:
docker compose up service
/rate-limited-queue/bulk-add
endpoint to queue up dummy jobs that are ready for processing.curl -X POST http://localhost:8080/rate-limited-queue/bulk-add
Open the bull-board dashboard and see the “waiting” tab is populated with the jobs you spun up. They will remain here until we start the worker and they get processed.
Start the worker in another tab / terminal.
docker compose up rate-limited-queue-worker