npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sns-sqs-slq-code7

v1.1.0

Published

A AWS SNS, SQS, and SLQ wrapper for Node.js

Downloads

5

Readme

SNS SQS SLQ Manager

SNS-SQS-SLQ é um pacote que simplifica o acesso às configurações de filas de mensagens da Amazon. O intuito é centralizar todos os principais recursos utilizados para configuração.

Este pacote de nó foi criado com a arquitetura de microsserviço em mente, portanto, é adequado quando a arquitetura de software requer muita configuração de banco de dados em torno de todos os microsserviços.

Instalação

Antes de instalar algumas configurações são necessárias.

Set up the environment variable

Crie um arquivo para armazenar as variáveis ambientes .env e insir os atributos abaixo:

NODE_ENV=development OU staging OU production

AWS_REGION=REGIAO_EM_QUE_ACESSA_AS_CONFIGURACOES Ex. sa-east-1
AWS_ACCESS_KEY=CHAVE_DE_ACESSO_DO_SEU_USER_NA_AMAZON 
AWS_SECRET_KEY=SENHA_DE_ACESSO_DO_SEU_USER_NA_AMAZON
AWS_API_VERSION=VERSAO_DA_API_NA_AMAZON Ex. 2012-11-05

Pronto, agora você já pode instalar este pacote pelo npm e importá-lo no seu projeto.

    $ npm install --save sns-sqs-slq-code7

Usage

Para usar adequadamente o pacote de nós, basta instanciar um novo objeto.

    const SNSSQS = require('sns-sqs-slq-code7');
    const manager = new SNSSQS.defaut();

Métodos disponíveis e seus parâmetros.

getAllTopics() retorna todos os tópicos SNS criados na região.

const allTopics = await manager.getAllTopics();

getAllQueue() retorna todas as filas SQS criadas.

const allQueue = await manager.getAllQueue();

createOrGetTopic() cria um tópico no padrão FIFO ou retorna o tópico que possui esse nome.

const topic = await manager.createOrGetTopic(
  topicName: String
);

createOrGetQueue() cria uma fila SQS no padrão FIFO ou retorna a fila que possui esse nome.

const queue = await manager.createOrGetQueue(
  queueName: String
);

subscribeToTopic() inscreve uma fila SQS em um tópico SNS. Mensagens publicadas em tópicos são direcionadas à todas as filas SQS incritas desse tópico.

const response = await manager.subscribeToTopic(
  topicArn: String,
  queueArn: String,
  queueUrl: String,
);

publishToTopic() envia(publica) uma mensagem para(no) o tópico informado. Os atributos da mensagem (MessageAttributes) são utilizados em filas SQS que possuem Política de filtragem.

const response = await manager.publishToTopic(
    topicName: String,
    message: String,
    messageGroupId: String, 
    messageDeduplicationId: String,
    topicArn: String,
    MessageAttributes?: { 
        [key: String]:  
        { 
            DataType: String;
            StringValue: String
        } 
    }
);

getTopicAttributes() obtem os atributos de um tópico SNS.

const topicAttributes = await manager.getTopicAttributes(
  topicArn: String
);

getQueueAttributes() obtem os atributos do tipo QueueArn de uma fila SQS.

const queueAttributes = await manager.getQueueAttributes(
  queueUrl: String
);

getSubscriptionsInTopic() obtem todas as filas SQS inscritas em um tópico específico e seus respectivos SubscriptionArn.

const subscriptionsInTopic = await manager.getSubscriptionsInTopic(
  topicArn: String
);

getSubscriptionsInTopic() obtem todas as filas SQS inscritas em um tópico específico e seus respectivos SubscriptionArn.

const subscriptionsInTopic = await manager.getSubscriptionsInTopic(
  topicArn: String
);

setFilterPolicyAttributeInSubscription() altera as políticas de filtro de um tópico SNS.

const response = await manager.setFilterPolicyAttributeInSubscription(
  topicArn: String,
  SubscriptionArn: String, 
  attributeValue: { [key: String]: Array<Any> };

);