# ric-utils-rabbit-rpc

> RPCv1 service communication

Latest version **1.0.16** (published 2021-09-02) · 0 weekly downloads

## Install

```sh
npm install ric-utils-rabbit-rpc
pnpm add ric-utils-rabbit-rpc
yarn add ric-utils-rabbit-rpc
bun add ric-utils-rabbit-rpc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.16 |
| Published | 2021-09-02 |
| First published | 2021-09-02 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 19.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Rightech IoT Cloud |
| Maintainers | prohazko |

## Links

- npm: https://www.npmjs.com/package/ric-utils-rabbit-rpc
- npm.io page: https://npm.io/package/ric-utils-rabbit-rpc

## Dependencies (4)

- [dotenv](https://npm.io/package/dotenv.md) ^4.0.0
- [node-uuid](https://npm.io/package/node-uuid.md) ^1.4.7
- [ric-utils-misc](https://npm.io/package/ric-utils-misc.md) ^1.0.33
- [@rightech/utils](https://npm.io/package/@rightech/utils.md) ^0.1.8

## Recent versions

- 1.0.16 (latest) — 2021-09-02

## README

# ric-utils-rabbit-rpc

[![build status](https://code.rightech.io/rightech-utils/ric-utils-rabbit-rpc/badges/master/build.svg)](https://code.rightech.io/rightech-utils/ric-utils-rabbit-rpc/commits/master)

### Install

```
npm i --save-dev ric-utils-rabbit-rpc
npm shrinkwrap
```

## Usage

### Client

```javascript
const rpc = require('ric-utils-rabbit-rpc').Client;

const rabbit = app.interfaces.transport.rabbitmq;

const client = new rpc.Client(
  'ric.<service>.control',
  'ric.<service>.replies');
  
client.connect(rabbit);

client.call('some-method', {param1 : 'a', param2 : 'b'}, (err, res) => {
  console.log('err', err);
  console.log('res', res);
});
```


V2

## Usage

```
<Object RpcController>.getClient(<name service to receive calls>);
```

Example: for creation client from call methods service `ric-handler` need
paste this code:

```
...
const handlerRpc = rpcManager.getClient('ric-handler');

handlerRpc.call('get-handlers', (err, result) => {
    if (err) {
        return console.log(err); // if call was finished with errors
                                 // print type error, for example: 
                                 // 'Internal error', 'Parse error' or other
                                 // error type
    }
    
    console.log(result);         // if call was finished success:
                                 //            [
                                 //             '<handler #1>',
                                 //             '<handler #2>',
                                 //             ...]
});

---
_Source: https://npm.io/package/ric-utils-rabbit-rpc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
