Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.07 KB

README.md

File metadata and controls

54 lines (39 loc) · 1.07 KB

Simple AWS SDK

Classes to make it easier to work with the AWS SDK

Examples

Initialize library

const saws = new SAWS();

// SQS
const sqs = saws.sqs(null, null, null, process.env.AWS_QUEUE_URL);

SQS

const queues = await sqs.listQueues()
    .then((resp: IResponse) => resp)
    .catch((err: IResponse) => err);

Get Queue url by queue name

const queues = await sqs.getQueueUrlByName(process.env.AWS_QUEUE_NAME)
    .then((resp: IResponse) => resp)
    .catch((err: IResponse) => err);

Send a message to queue

const sendMessage = await sqs.sendMessage(message, groupId, deduplicationId)
    .then((resp: IResponse) => resp)
    .catch((err: IResponse) => err);

Receive messages from queue

const receiveMessage = await sqs.receiveMessages(1, 60, 0)
    .then((resp: IResponse) => resp)
    .catch((err: IResponse) => err);

Delete a message from queue

const deleteMessage = await sqs.deleteMessage(message.ReceiptHandle)
    .then((resp: IResponse) => resp)
    .catch((err: IResponse) => err);