Small program to see queue in action. I created this program to see how can we do heavy works efficiently without overloading the server.
- Uses BullMQ for queue management
- Processes images using Sharp
- Prevents server overload by offloading heavy tasks to background workers
-
Build the Docker image:
docker build -t image-api . -
Start all services with Docker Compose:
docker-compose up
This will start:
- API server (port 8000)
- Background worker
- Redis server
-
Stop services:
docker-compose down
- Send an image processing request to the API endpoint
http://localhost:8000/api/v1/upload - The image will be queued and processed in the background.
- Processed images are saved to the
uploads/converteddirectory.
src/queue/- BullMQ queue and worker setupsrc/middleware/- Image upload middleware using multer