0.0.10 • Published 4 years ago

amqp-modern v0.0.10

Weekly downloads
24
License
ISC
Repository
github
Last release
4 years ago

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!' });
0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago