Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/noblesamurai/amqplib-rpc-client
Rpc client based on amqplib.
https://github.com/noblesamurai/amqplib-rpc-client
Last synced: about 1 month ago
JSON representation
Rpc client based on amqplib.
- Host: GitHub
- URL: https://github.com/noblesamurai/amqplib-rpc-client
- Owner: noblesamurai
- License: other
- Created: 2016-05-18T04:14:33.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-10T05:13:41.000Z (over 7 years ago)
- Last Synced: 2024-12-01T04:52:08.635Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# amqplib-rpc-client
Rpc client based on amqplib.
[![build status](https://secure.travis-ci.org/timothyleslieallen/amqplib-rpc-client.png)](http://travis-ci.org/timothyleslieallen/amqplib-rpc-client)
## Installation
This module is installed via npm:
``` bash
$ npm install amqplib-rpc-client
```## Example Usage
``` js
var amqplibRpcClient = require('amqplib-rpc-client'),
expect = require('expect.js');amqplibRpcClient(amqpUrl, exchange, 'add', { number1: 1, number2: 4 }).on('data', function(response) {
expect(response.answer).to.be(5);
});
```## Usage/conventions
Uses the `replyTo` field to transmit the expected routingKey a response should be publish on by the server.
Expects message to be valid JSON.
Will `emit()` events based on the `type` field of the message content. The entire JSON object is given as arg 2. e.g:
`emit('data', { type: 'data', result: 'moo' });`## Running tests
```
npm test
```To run the tests RabbitMQ is required. Either install it with your package
manager, or use docker to run a RabbitMQ instance.```
docker run -d --name amqp.test -p 5672:5672 rabbitmq
```