Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sqs-producer

Package Overview
Dependencies
Maintainers
2
Versions
42
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

  • 6.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
146K
increased by2.47%
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

FAQs

Package last updated on 01 Oct 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc