SimonJang / aws-sqs-push

Push messages to an AWS SQS queue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aws-sqs-push Build Status

Push messages to an AWS SQS (FIFO) queue

Small wrapper around the getQueueUrl and sendMessage from the AWS SQS SDK. This will automatically retrieve the queue url when sending a message. This is useful when you only have the queue name.

Requirements

  • Node >= 8.

Install

$ npm install --save aws-sqs-push

Usage

const sqsPush = require('aws-sqs-push');

const request = {
	MessageBody: JSON.stringify({message: 'foo'});
	DelaySeconds: 10
}

sqsPush('QueueName', request, '123456789101').then(sendMessageResponse => {
    // ...
});

const fifoRequest = {
	messageDeduplicationId: '12312333331323'
	messageGroupId: '8875gyukjdsioop90123',
	MessageBody: JSON.stringify({message: 'FIFO'});
}

sqsPush('QueueName.fifo', fifoRequest).then(sendMessageResponse => {
	// ...
});

API

sqsPush(queueName, request, [awsAccountId])

Result is the response of the AWS SQS sendMessage API

queueName

Required: true Type: string

Name of the queue you want to push a message to. This can be a cross account queue but permissions must be granted to able to push on that queue.

request

Required: true Type: object

Request properties are defined in the documentation of the sendMessage method of the AWS SDK

awsAccountId

Required: false Type: string

AWS account id of the owner of the queue. This optional parameter allows to push on cross account queue.

License

MIT © Simon Jang

About

Push messages to an AWS SQS queue

License:MIT License


Languages

Language:TypeScript 90.6%Language:JavaScript 9.4%