@hyper.software/sqs
v1.0.6
Published
Hyper Software SQS Helpers
Downloads
342
Readme
@hyper.software/sqs
Module with helpers for sqs
- build with TS
- can dispatch messages to SQS
- can build consumers that pull constantly data from sqs
- logs internally every action or fail
import * as sqs from '@hyper.software/sqs';
// initialize sqs lib, do this before anything else
sqs.setConfig({
region: 'eu-central-1',
accessKeyId: 'accessKeyId',
secretAccessKey: 'secretAccessKey',
signatureVersion: 'v4',
sender: 'software-name',
logger: myLogger, // should support logger.info, logger.warn, logger.error
});
// start 5 consumers in parallel to pull data - in case of high volume
sqs.buildConsumerArray<ISendDispatchEmailToSqsByLanguage>({
count: 5,
autoStart: true,
queueUrl,
action: (message: ISendDispatchEmailToSqsByLanguage) => sendEmail(message), // -> take your action when a message comes
});
// dispatch a message
sqs.dispatchMessage<ISendDispatchEmailToSqsByLanguage>(message);