New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

amqp-modern

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amqp-modern

Wrapper around amqplib that brings the client syntax into 2018

  • 0.0.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

AMQP Modern

A small amqplib wrapper for nodejs that simplifies interactions with queue systems.

  • Consuming a channel
  • Async / Await based
  • Publishing to a channel
  • Passing off JS objects, so you don't have to
  • It handles rejections and acknowledgments automatically

Install

npm install amqp-modern

Usage

import amqp from 'amqp-modern';

let client = amqp('amqp://connection string here');

//optional config
client.config({
  //catch and log any time a queue has an error
  onError: error => console.log(error),
  //wait 10 seconds after each failure, useful to not reject and retry instantly, probably looping really fast
  rejectionDelay: 10000,
});

//consume a channel
client.consume({
  channel: 'message',

  process: async message => {
    await sendAnEmail(message.description);
    //if this promise rejects, the queue will retry
  },
});

//somewhere in your app, publish to a channel

client.publish('message', { description: 'hello!' });

Keywords

FAQs

Package last updated on 13 Jun 2020

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