Gathering detailed insights and metrics for @ssut/nestjs-sqs
Gathering detailed insights and metrics for @ssut/nestjs-sqs
Gathering detailed insights and metrics for @ssut/nestjs-sqs
Gathering detailed insights and metrics for @ssut/nestjs-sqs
npm install @ssut/nestjs-sqs
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
215 Stars
58 Commits
53 Forks
9 Watching
1 Branches
16 Contributors
Updated on 27 Nov 2024
TypeScript (100%)
Cumulative downloads
Total Downloads
Last day
9.1%
16,077
Compared to previous day
Last week
7.6%
82,509
Compared to previous week
Last month
12.2%
332,286
Compared to previous month
Last year
64.9%
3,025,123
Compared to previous year
Tested with: AWS SQS and ElasticMQ.
Nestjs-sqs is a project to make SQS easier to use and control some required flows with NestJS. This module provides decorator-based message handling suited for simple use.
This library internally uses bbc/sqs-producer and bbc/sqs-consumer, and implements some more useful features on top of the basic functionality given by them.
1npm i --save @ssut/nestjs-sqs @aws-sdk/client-sqs
Just register this module:
1@Module({ 2 imports: [ 3 SqsModule.register({ 4 consumers: [], 5 producers: [], 6 }), 7 ], 8}) 9class AppModule {}
Quite often you might want to asynchronously pass module options instead of passing them beforehand.
In such case, use registerAsync()
method like many other Nest.js libraries.
1SqsModule.registerAsync({ 2 useFactory: () => { 3 return { 4 consumers: [], 5 producers: [], 6 }; 7 }, 8});
1SqsModule.registerAsync({
2 useClass: SqsConfigService,
3});
1SqsModule.registerAsync({ 2 imports: [ConfigModule], 3 useExisting: ConfigService, 4});
You need to decorate methods in your NestJS providers in order to have them be automatically attached as event handlers for incoming SQS messages:
1import { Message } from '@aws-sdk/client-sqs'; 2 3@Injectable() 4export class AppMessageHandler { 5 @SqsMessageHandler(/** name: */ 'queueName', /** batch: */ false) 6 public async handleMessage(message: Message) {} 7 8 @SqsConsumerEventHandler(/** name: */ 'queueName', /** eventName: */ 'processing_error') 9 public onProcessingError(error: Error, message: Message) { 10 // report errors here 11 } 12}
1export class AppService { 2 public constructor( 3 private readonly sqsService: SqsService, 4 ) { } 5 6 public async dispatchSomething() { 7 await this.sqsService.send(/** name: */ 'queueName', { 8 id: 'id', 9 body: { ... }, 10 groupId: 'groupId', 11 deduplicationId: 'deduplicationId', 12 messageAttributes: { ... }, 13 delaySeconds: 0, 14 }); 15 } 16}
See here, and note that we have same configuration as bbc/sqs-consumer's.
In most time you just need to specify both name
and queueUrl
at the minimum requirements.
This project is licensed under the terms of the MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
Found 12/30 approved changesets -- score normalized to 4
Reason
6 existing vulnerabilities detected
Details
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
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