Registry / messaging / sqs-queue-parallel

sqs-queue-parallel

JSON →
library0.1.6jsnpmunverified

Sqs-queue-parallel is a Node.js library built on top of Amazon AWS SQS that provides concurrent and parallel message polling. It allows you to create multiple SQS queue watchers (concurrency) each capable of receiving multiple messages (maxNumberOfMessages). This configuration enables parallel processing of messages, e.g., 2 concurrent watchers each fetching up to 4 messages can handle up to 8 message events in parallel. The library is at version 0.1.6 (released via npm) and appears to be stable but with no recent updates. It differentiates from standard AWS SDK polling by offering built-in concurrency and event-driven message handling.

npm install sqs-queue-parallel
INSTALL
IMPORT
SIG · SQS-QUEUE-PARALLEL
S
sqs-queue-parallel
messagingjavascriptv0.1.6
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.

SqsQueueParallel
const SqsQueueParallel = require('sqs-queue-parallel');
import SqsQueueParallel from 'sqs-queue-parallel';
The package is CommonJS-only; no ESM exports provided. Using ES6 import will fail.
SqsQueueParallel (constructor)
const queue = new SqsQueueParallel({ name: 'my-queue' });
const queue = SqsQueueParallel({ name: 'my-queue' });
Must use `new` keyword; the constructor is not a factory function.
client property
const client = queue.client;
queue.client();
client is a property, not a method.

Shows basic setup: create SqsQueueParallel instance with AWS credentials, listen for 'message' events, delete and advance to next message, and send a message.

const SqsQueueParallel = require('sqs-queue-parallel'); const queue = new SqsQueueParallel({ name: 'my-queue', region: process.env.AWS_REGION ?? 'us-east-1', accessKeyId: process.env.AWS_ACCESS_KEY ?? '', secretAccessKey: process.env.AWS_SECRET_KEY ?? '', maxNumberOfMessages: 4, concurrency: 2, waitTimeSeconds: 20 }); queue.on('message', function (e) { console.log('Received message:', e.data.MessageId); // Process message... e.deleteMessage(function(err, data) { if (err) console.error('Delete error:', err); e.next(); }); }); queue.on('error', function (err) { console.error('Queue error:', err); }); // Send a message queue.sendMessage({ body: 'Hello!' }, function(err, data) { if (err) console.error('Send error:', err); });
Debug
Known issues
deprecatedThe library uses the older AWS SDK v2 client (`aws-sdk` package) which is in maintenance mode and will be supplanted by SDK v3 (`@aws-sdk/client-sqs`).
fix
Consider migrating to a more modern SQS library or use the AWS SDK v3 directly if you need latest features.
affects: <=0.1.6
gotchaYou must call `e.next()` after processing each message to free the concurrency slot and allow new messages to be polled. Forgetting this will eventually stall the queue.
fix
Always ensure `e.next()` is called exactly once per message event, even on error.
affects: *
gotchaThe `maxNumberOfMessages` and `concurrency` settings multiply to give maximum concurrent messages. Setting high values can overwhelm your application if not tuned properly.
fix
Start with small values (e.g., concurrency=1, maxNumberOfMessages=1) and increase gradually while monitoring resource usage.
affects: *
gotchaThe library does not expose a `stop` or `destroy` method; once created, the polling continues until the process ends. This can cause memory leaks in long-running applications.
fix
Plan for process termination; or fork and kill subprocesses. There is no graceful shutdown API.
affects: *
deprecatedAWS credential keys (`accessKeyId`, `secretAccessKey`, `region`) are passed directly in constructor. Modern best practice uses IAM roles or credential chains.
fix
Consider using AWS SDK's default credential chain (e.g., environment variables, EC2 instance role) instead of hardcoding keys.
affects: *
Errors
Common errors & fixes
TypeError: SqsQueueParallel is not a constructor
Forgetting `new` keyword when instantiating the queue.
fix
Use `new SqsQueueParallel({...})` instead of `SqsQueueParallel({...})`.
Error: Name is required
The `name` option is missing when creating the SqsQueueParallel instance.
fix
Provide a `name` property in the options object: `{ name: 'my-queue' }`.
Uncaught TypeError: Cannot read property 'MessageId' of undefined
Attempting to access message data before the 'message' event fires with valid data, or using `e.data.MessageId` but `e.data` is undefined.
fix
Check that `e.data` exists and contains the expected properties; see AWS SDK ReceiveMessageResult structure.
Error: connect ETIMEDOUT ...:443
Network issue or incorrect AWS region/endpoint causing connection timeout.
fix
Verify the region is correct and the host has outbound internet access. Check firewall settings.
Upgrade
Version history
0.1.6latest on npm
Audit
Dependencies
aws-sdkrequiredRequired to interact with Amazon SQS. The library uses the AWS SDK for SQS operations.
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
sqs-queue-parallel — npm install sqs-queue-parallel · libregistry