Gathering detailed insights and metrics for sqs-producer
Gathering detailed insights and metrics for sqs-producer
Gathering detailed insights and metrics for sqs-producer
Gathering detailed insights and metrics for sqs-producer
@devplace/sqs-producer
Devplace SQS producer lib
@ssut/nestjs-sqs
[![Test](https://github.com/ssut/nestjs-sqs/workflows/Test/badge.svg)](https://github.com/ssut/nestjs-sqs/actions?query=workflow%3ATest) [![npm version](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs.svg)](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs)
sqs-producer-2
Enqueues messages onto a given SQS queue
@aws-sdk/client-sqs
AWS SDK for JavaScript Sqs Client for Node.js, Browser and React Native
Simple scaffolding for applications that produce SQS messages
npm install sqs-producer
55.1
Supply Chain
100
Quality
84.1
Maintenance
100
Vulnerability
99.6
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
207 Stars
226 Commits
51 Forks
36 Watching
17 Branches
93 Contributors
Updated on 31 Oct 2024
TypeScript (99.58%)
JavaScript (0.42%)
Cumulative downloads
Total Downloads
Last day
-3.3%
28,008
Compared to previous day
Last week
4.1%
155,305
Compared to previous week
Last month
7.5%
655,857
Compared to previous month
Last year
35.3%
6,449,539
Compared to previous year
1
1
26
Enqueues messages onto a given SQS queue.
To install this package, enter the following command into your terminal (or the variant of whatever package manager you are using):
npm install sqs-producer
We will only support Node versions that are actively or security supported by the Node team. If you are still using an Node 14, please use a version of this library before the v3.2.1 release, if you are using Node 16, please use a version before the v3.3.0 release.
Visit https://bbc.github.io/sqs-producer/ for the full API documentation.
1import { Producer } from 'sqs-producer'; 2import { SQSClient } from '@aws-sdk/client-sqs'; 3 4// create simple producer 5const producer = Producer.create({ 6 queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name', 7 region: 'eu-west-1' 8}); 9 10// send messages to the queue 11await producer.send(['msg1', 'msg2']); 12 13// get the current size of the queue 14const size = await producer.queueSize(); 15console.log(`There are ${size} messages on the queue.`); 16 17// send a message to the queue with a specific ID (by default the body is used as the ID) 18await producer.send([ 19 { 20 id: 'id1', 21 body: 'Hello world' 22 } 23]); 24 25// send a message to the queue with 26// - delaySeconds (must be an number contained within 0 and 900) 27// - messageAttributes 28await producer.send([ 29 { 30 id: 'id1', 31 body: 'Hello world with two string attributes: attr1 and attr2', 32 messageAttributes: { 33 attr1: { DataType: 'String', StringValue: 'stringValue' }, 34 attr2: { DataType: 'Binary', BinaryValue: new Buffer('binaryValue') } 35 } 36 }, 37 { 38 id: 'id2', 39 body: 'Hello world delayed by 5 seconds', 40 delaySeconds: 5 41 } 42]); 43 44// send a message to a FIFO queue 45// 46// note that AWS FIFO queues require two additional params: 47// - groupId (string) 48// - deduplicationId (string) 49// 50// deduplicationId can be excluded if content-based deduplication is enabled 51// 52// https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queue-recommendations.html 53await producer.send({ 54 id: 'testId', 55 body: 'Hello world from our FIFO queue!', 56 groupId: 'group1234', 57 deduplicationId: 'abcdef123456' // typically a hash of the message body 58});
By default the consumer will look for AWS credentials in the places specified by the AWS SDK. The simplest option is to export your credentials as environment variables:
1export AWS_SECRET_ACCESS_KEY=... 2export AWS_ACCESS_KEY_ID=...
If you need to specify your credentials manually, you can use a pre-configured instance of the SQS Client client.
1import { Producer } from 'sqs-producer'; 2import { SQSClient } from '@aws-sdk/client-sqs'; 3 4// create simple producer 5const producer = Producer.create({ 6 queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name', 7 region: 'eu-west-1', 8 sqs: new SQSClient({ 9 region: 'my-region', 10 credentials: { 11 accessKeyId: 'yourAccessKey', 12 secretAccessKey: 'yourSecret' 13 } 14 }) 15}); 16 17// send messages to the queue 18await producer.send(['msg1', 'msg2']);
1npm test
For coverage report, run the command:
1npm run coverage
To check for problems using ESLint
1npm run lint
We welcome and appreciate contributions for anyone who would like to take the time to fix a bug or implement a new feature.
But before you get started, please read the contributing guidelines and code of conduct.
SQS Producer is distributed under the Apache License, Version 2.0, see LICENSE for more information.
No vulnerabilities found.
Reason
no vulnerabilities detected
Reason
tokens are read-only in GitHub workflows
Reason
license file detected
Details
Reason
no dangerous workflow patterns detected
Reason
all dependencies are pinned
Details
Reason
no binaries found in the repo
Reason
update tool detected
Details
Reason
GitHub code reviews found for 11 commits out of the last 30 -- score normalized to 3
Details
Reason
0 commit(s) out of 30 and 0 issue activity out of 28 found in the last 90 days -- score normalized to 0
Reason
no badge detected
Reason
security policy file not detected
Reason
project is not fuzzed
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2022-08-15
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More