Socket
Socket
Sign inDemoInstall

@aws-sdk/middleware-sdk-sqs

Package Overview
Dependencies
Maintainers
5
Versions
166
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/middleware-sdk-sqs

[![NPM version](https://img.shields.io/npm/v/@aws-sdk/middleware-sdk-sqs/latest.svg)](https://www.npmjs.com/package/@aws-sdk/middleware-sdk-sqs) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/middleware-sdk-sqs.svg)](https://www.npmjs.com/packag


Version published
Weekly downloads
2.1M
decreased by-1.7%
Maintainers
5
Weekly downloads
 
Created

What is @aws-sdk/middleware-sdk-sqs?

@aws-sdk/middleware-sdk-sqs is a middleware package for the AWS SDK for JavaScript (v3) that provides specialized middleware for Amazon Simple Queue Service (SQS). It helps in handling SQS-specific tasks such as message deduplication, message attribute handling, and more.

What are @aws-sdk/middleware-sdk-sqs's main functionalities?

Message Deduplication

This feature allows you to send messages with deduplication enabled, which is useful for FIFO (First-In-First-Out) queues. The middleware automatically handles deduplication logic.

const { SQSClient, SendMessageCommand } = require('@aws-sdk/client-sqs');
const { applyMiddleware } = require('@aws-sdk/middleware-sdk-sqs');

const client = new SQSClient({ region: 'us-east-1' });
applyMiddleware(client);

const params = {
  QueueUrl: 'https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue',
  MessageBody: 'Hello, world!',
  MessageDeduplicationId: 'unique-id-123',
  MessageGroupId: 'group-id-1'
};

const command = new SendMessageCommand(params);
client.send(command).then((data) => {
  console.log('Message sent:', data);
}).catch((error) => {
  console.error('Error sending message:', error);
});

Message Attribute Handling

This feature allows you to send messages with custom attributes. The middleware helps in managing and sending these attributes along with the message.

const { SQSClient, SendMessageCommand } = require('@aws-sdk/client-sqs');
const { applyMiddleware } = require('@aws-sdk/middleware-sdk-sqs');

const client = new SQSClient({ region: 'us-east-1' });
applyMiddleware(client);

const params = {
  QueueUrl: 'https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue',
  MessageBody: 'Hello, world!',
  MessageAttributes: {
    'AttributeOne': {
      DataType: 'String',
      StringValue: 'ValueOne'
    },
    'AttributeTwo': {
      DataType: 'Number',
      StringValue: '123'
    }
  }
};

const command = new SendMessageCommand(params);
client.send(command).then((data) => {
  console.log('Message sent with attributes:', data);
}).catch((error) => {
  console.error('Error sending message:', error);
});

Other packages similar to @aws-sdk/middleware-sdk-sqs

FAQs

Package last updated on 07 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