A wrapper around SQS
npm install --save sqess
# Or, if you fancy
yarn add sqess
Basic usage is as follows, check out the complete documentation if you feel so inclined.
import Queue from 'sqess';
async function main() {
// Initializes the sqess instance but doesn't create the queue
const queue = new Queue({
queueName: 'test-queue-1',
handler: async (queueItem) => Promise.resolve(true),
onFinish: () => true,
});
// Actually creates the queue
await queue.create();
// Fill that queue up
await queue.fill([/* Either a single item or an array of items */]);
// Process queue items until there's no tomorrow
await queue.process();
}
main();
Matches against valid standard queue names. The only valid non-standard queue
names belong to FIFO queues which have .fifo appended.
By default, load credentials from environment variables or the Shared Credentials File. as recommended.
Ensures that a queue name is between 1-80 characters long and doesn't contain any illegal characters. See QueueConfig.queueName.
Our default long-polling interval (the max allowed).
Generated using TypeDoc
The handler will be invoked with each item from the queue (or with an array of queue items if QueueConfig.batchSize is specified) and should return a Promise.