Registry / messaging / simple-worker

simple-worker

JSON →
library3.0.1jsnpmunverified

SimpleWorker is a straightforward priority job queue library for Node.js (v3.0.1). It uses Redis as a backend for fast, reliable job processing with customizable concurrency and retry logic. Unlike full-featured queue systems like Bull or Bee-Queue, SimpleWorker focuses on minimal setup and a clean API. The library is actively maintained with periodic updates. Key differentiators include a simple configuration, priority support, and worker-level concurrency control. However, documentation is sparse, and the main usage guidance points to a code example.

npm install simple-worker
INSTALL
IMPORT
SIG · SIMPLE-WORKER
S
simple-worker
messagingjavascriptv3.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import SimpleWorker from 'simple-worker'
const SimpleWorker = require('simple-worker')
Package ships an ES module; CommonJS require gives default export as an object with .default property.
Worker
import { Worker } from 'simple-worker'
const Worker = require('simple-worker').Worker
Named export for individual worker creation.
Queue
import { Queue } from 'simple-worker'
const Queue = require('simple-worker').Queue
Named export for queue instance.

Basic setup of a SimpleWorker with Redis client, job processing, event listeners, and job addition.

import SimpleWorker from 'simple-worker'; import { createClient } from 'redis'; const client = createClient({ url: process.env.REDIS_URL ?? 'redis://localhost:6379' }); const worker = new SimpleWorker(client, 'myqueue'); worker.process(async (job) => { console.log('Processing job:', job.id); return job.data; }); worker.on('completed', (job) => { console.log('Job completed:', job.id); }); worker.on('failed', (job, err) => { console.error('Job failed:', job.id, err); }); worker.start(); // Add a job await worker.add({ payload: 'hello' }, { priority: 1 });
Debug
Known issues
gotchaTests clear production Redis instances; do not run tests against production.
fix
Use a separate Redis instance for testing.
affects: all
breakingFrom v2 to v3, the API changed from class-based to functional; old instantiation syntax no longer works.
fix
Use SimpleWorker constructor with Redis client and queue name.
affects: >=3.0.0
deprecatedThe `redis` package v3 is deprecated; use `ioredis` or `redis` v4.
fix
Switch to ioredis or update to redis v4.
affects: >=3.0.0
gotchaJob data must be serializable to JSON; functions or circular references cause errors.
fix
Ensure job data is plain objects/arrays with serializable values.
affects: all
breakingv3 removed callback-based processing; only async/await is supported.
fix
Use async functions in worker.process().
affects: >=3.0.0
Errors
Common errors & fixes
Error: Job data must be a plain object. Received: [Function]
Job data is not serializable because it contains a function.
fix
Ensure job.add() receives a plain object with serializable values.
TypeError: worker.process is not a function
Using old v2 API where process was a method on Queue class.
fix
Upgrade to v3 API: import SimpleWorker and use new SimpleWorker() constructor.
ERR! config.redis is required
Missing Redis client configuration.
fix
Pass a valid Redis client instance to the SimpleWorker constructor.
Error: Cannot find module 'redis'
redis package is a peer dependency and not installed.
fix
Run npm install redis.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
redisrequiredRedis client for queue storage
Agent activity
15 hits · last 30 days
node
12
Amazon
1
OpenAI (training)
1
Resources
simple-worker — npm install simple-worker · libregistry