Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
@knockaway/sqsiphon
Advanced tools
_sqsiphon_ provides a framework for writing [Amazon SQS][sqs] polling applications. It is designed to poll, and process messages, as quickly as possible. FIFO queues are supported.
sqsiphon provides a framework for writing Amazon SQS polling applications. It is designed to poll, and process messages, as quickly as possible. FIFO queues are supported.
A
is untagged, message B
is tagged for "foo", and
message C
is tagged for "bar". Message A
will be put on the general
processing batch and two new batches will be created: "foo" and "bar", each
with one message added for processing.FIFO Errors: When a message on a FIFO queue cannot be processed successfully, the message, and any remaining messages in the batch, will be left on the queue. It is recommened that a corresponding dead letter queue be configured so that these messages will be moved there by SQS.
const { SQS } = require('aws-sdk');
const sqs = new SQS({
apiVersion: '2012-11-05',
region: 'us-east-1'
});
const sqsiphonFactory = require('@knockaway/sqsiphon');
const app = sqsiphonFactory({
sqs,
queueUrl: 'url for the sqs queue',
handler: messageHandler
});
function shutdown(signal) {
app.stop();
}
['SIGTERM', 'SIGINT'].forEach(signal => process.on(signal, shutdown));
if ((require.main === module) === true) {
app.start();
}
async function messageHandler(message) {
// `message` is an SQS message as returned by the `aws-sdk`
// ...
// Do something with the message or `throw Error('failed')`
}
This module exports a factory function which accepts an options object with the following properties:
logger
(optional): An object that follows the Log4j logger interface.
The default is an instance of abstract-logging
.sqs
(required): An instance of SQS
from the aws-sdk
.queueUrl
(required): A string URL pointing to the SQS instance to poll.handler
(required): A function to handle received messages. Must be an
async function
. The function will receive one parameter: message
. The
parameter is an instance of
SQS Message.
If the message cannot be processed for any reason, an instance of Error
should be thrown. If no error is thrown, the message has been considered to
be successfully processed.tracer
(optional): an OpenTracing compliant tracer instance.receiveMessageParameters
(optional): an object that conforms to the object
described by
sqs.receiveMessage
.
The default has: AttributeNames: ['All']
, MaxNumberOfMessages: 10
,
MessageAttributeNames: ['All']
, and VisibilityTimeout: 30
. The QueueUrl
is always overridden by the passed in queueUrl
value.The factory returns an application instance. The application instance is an event emitter.
isRunning
(boolean): indicates if the application is polling for messages
or not.start()
: initiates the application to start polling for messages.stop()
: initiates the application to stop polling for messages. Any
messages currently being processed will be completed.error
: fired when an unexpected error occurs. Receives an Error
object.request-error
: fired when a communication error occurs. Receives an
Error
object.processing-error
: fired when an error occurs while processing a message.
Receives an object with error
and message
properties.fifo-processing-aborted
: fired when a FIFO batch stop processing due to an
error. Receives an object with message
and messages
properties. This event
will fire subsequent to a processing-error
event.received-messages
: fired when a new batch of messages has been received.
Receives an array of SQS message objects.handled-message
: fired when a message has been successfully handled.
Receives an SQS message object.FAQs
_sqsiphon_ provides a framework for writing [Amazon SQS][sqs] polling applications. It is designed to poll, and process messages, as quickly as possible. FIFO queues are supported.
The npm package @knockaway/sqsiphon receives a total of 3 weekly downloads. As such, @knockaway/sqsiphon popularity was classified as not popular.
We found that @knockaway/sqsiphon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 30 open source maintainers 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
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.