🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

sqs-producer

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqs-producer

Enqueues messages onto a given SQS queue

7.0.0
latest
Source
npm
Version published
Weekly downloads
208K
7.35%
Maintainers
2
Weekly downloads
 
Created

What is sqs-producer?

The sqs-producer npm package is a simple library for sending messages to an AWS SQS (Simple Queue Service) queue. It provides a straightforward API for creating and sending messages, making it easier to integrate SQS into your Node.js applications.

What are sqs-producer's main functionalities?

Create a Producer

This feature allows you to create a producer instance that is configured to send messages to a specific SQS queue. You need to provide the queue URL and the AWS region.

const { Producer } = require('sqs-producer');

const producer = Producer.create({
  queueUrl: 'https://sqs.us-east-1.amazonaws.com/account-id/queue-name',
  region: 'us-east-1'
});

Send a Single Message

This feature allows you to send a single message to the SQS queue. You need to provide a message ID and the message body.

producer.send({
  id: 'id1',
  body: 'Hello SQS!'
}, (err) => {
  if (err) console.error(err);
  else console.log('Message sent successfully');
});

Send Multiple Messages

This feature allows you to send multiple messages in a single batch to the SQS queue. You need to provide an array of messages, each with a unique ID and message body.

producer.send([{
  id: 'id1',
  body: 'Hello SQS!'
}, {
  id: 'id2',
  body: 'Hello again!'
}], (err) => {
  if (err) console.error(err);
  else console.log('Messages sent successfully');
});

Send Messages with Delay

This feature allows you to send a message to the SQS queue with a delay. You need to provide the message ID, message body, and the delay in seconds.

producer.send({
  id: 'id1',
  body: 'Hello SQS!',
  delaySeconds: 10
}, (err) => {
  if (err) console.error(err);
  else console.log('Message sent successfully with delay');
});

Other packages similar to sqs-producer

Keywords

aws

FAQs

Package last updated on 09 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts