
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
aws-sqs-processor
Advanced tools
Processing messages from an Amazon AWS SQS queue basically boils down to a loop that receives messages that are ready to be processed, process the messages and delete those message that have been processed. This library offers a nice API to do this loop.
Simply install the library using npm:
npm install --save aws-sqs-processor
The module exports a function that can be used to instantiate a processor. The functions accepts a set of configuration options and after calling start() on the processor it will emit any message to be processed using a message event.
The event listener for the message event is passed two arguments for each message. The first argument is the message in the format it is returned by the aws-sdk package. The second argument is a function that must be called to inform the processor when processing has finished.
| Key | Description |
|---|---|
| accessKeyId | Amazon AWS Access Key ID |
| secretAccessKey | Amazon AWS Secret Access Key |
| region | Region in which the queue exists |
| queueUrl | URL of the SQS queue |
| maxNumberOfMessagesProcessing | Maximum number of messages that is acceptable to being processed concurrently, default = 50 |
| maxNumberOfMessagesPerBatch | Maximum number of messages to retrieve in a single retrieveMessage request; value = 1 - 10, default = 10 |
| visibilityTimeout | Visibility timeout argument for the retrieveMessage request; value = 1 - 43200, default = 30 |
| waitTimeSeconds | Number of seconds a long polling retrieveMessage request should wait; value = 1 - 20, default = 20 |
The processor will try to retrieve up to maxNumberOfMessagesPerBatch per retrieveMessage request. Multiple retrieveMessage requests will be performed, up to the point where the number of messages that are being processed reaches maxNumberOfMessagesProcessing. At that point, the processor will wait until processing completes or failes for already dispatched messages.
When processing a message takes too long, the processor will automatically send a request to change the visibility of a message one second before the expected visibility deadline. You need to mark the processing of a message as completed or failed to notify the processor that the visibility of the message doesn't need to be updated anymore.
To mark a message a completed, call the function that is passed as the second argument to your message event handler without any argument. The processor will automatically request Amazon to delete the message.
A message will be marked as failed in the following cases:
message event handler with an argumentmessage event handlermessage event handler is registered (so the message won't even be processed)When a message is marked as failed, the processor will no longer change the visibility of the message, so it will become visible after the visibility timeout. After that moment, Amazon will return the message to this or another processor.
var sqs = require('aws-sqs-processor')({
accessKeyId: 'akid',
secretAccessKey: 'secret',
region: 'eu-west-1',
queueUrl: 'https://sqs.eu-west-1.amazonaws.com/123456789012/example-queue'
});
sqs.on('message', function(message, done) {
console.log('-----');
console.log('Received message ' + message.MessageId);
console.log('Message body:');
console.log(message.Body);
console.log('-----');
setTimeout(function() {
/* I hope you're going to do some real work,
but I'm going to pretend, because I'm lazy.
*/
done();
}, 5000);
});
sqs.start();
FAQs
Library to assist in processing of Amazon AWS SQS queue messages
The npm package aws-sqs-processor receives a total of 35 weekly downloads. As such, aws-sqs-processor popularity was classified as not popular.
We found that aws-sqs-processor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.