This package has been deprecated

Author message:

Module deprecated and no longer maintained, merged into the awesome BunnyMQ module. npm install bunnymq. https://github.com/dial-once/node-bunnymq

rabbitrpc

1.1.1 • Public • Published

node-rabbitrpc

Some modules to require to create producers / consumers using AMQP-RPC

features

  • Auto reconnect
  • Built on top of amqplib
  • Full promise support

how to use it

consumer

listen on a queue and send back a message

//you can also just require('amqprpc')(); if your broker is local
var amqprpc = require('rabbitrpc')( { AMQP_URL: 'amqp://localhost' });
amqprpc.consumer
.connect() //this create your channels and setup the amqp connexion
.then(function(){
  amqprpc.consumer.createQueue('queue:name', function(msg){
    //handle your msg, you can create a promise, or return a value. Result will be sent to producer
  });
});

producer

send a message to a queue and listen for a response

//you can also just require('amqprpc')(); if your broker is local
var amqprpc = require('rabbitrpc')( { AMQP_URL: 'amqp://localhost' });
amqprpc.producer
.send('queue:name', { message: 'ok', data: {/* whatever */} })
.then(function(response){
  //handle your response here!
  //see consumer example to check how to respond to a producer
});

Readme

Keywords

none

Package Sidebar

Install

npm i rabbitrpc

Weekly Downloads

3

Version

1.1.1

License

GPL-2.0

Last publish

Collaborators

  • dial-once
  • mrister
  • jkernech
  • ky23