sqs-bull
v1.2.3
Published
SQS message consumer
Downloads
61
Readme
Install
$ npm i @ghostmonitor/sqs-bull
Usage
const QueueWrapper = require('@ghostmonitor/gm-queue-wrapper');
const SomeQueueConfig = new QueueWrapper('gm-some-service');
const SqsBull = require('sqs-bull');
const queue = new SqsBull({
queueUrl: SomeQueueConfig.getQueueUrl(), // required
visibilityTimeout: 30
attributeNames: [],
messageAttributeNames: [],
concurrency: 1,
longPollWaitTimeSeconds: 20,
authenticationErrorTimeout: 10000,
sqsSignatureVersion: 'v4',
disableMessageProcessingTimeout: false,
processNonJson: false,
restartOnUnexpectedError: true,
unexpectedErrorDelay: 10000
});
queue.on('processing_error', (err) => {
console.error('Error processing message', err.message, err.stack)
})
queue.process(async (message) => {
// do processing...
})
Testing
$ docker run -p 9324:9324 -p 9325:9325 softwaremill/elasticmq
$ npm test