# rabbitmq-rpc-client

> AMQP (RabbitMQ) Controller for RPC Client. Asynchronous handling of response using RxJS

Latest version **1.0.1** (published 2016-07-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install rabbitmq-rpc-client
pnpm add rabbitmq-rpc-client
yarn add rabbitmq-rpc-client
bun add rabbitmq-rpc-client
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-07-26 |
| First published | 2016-07-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Don Burgess |
| Maintainers | db3dev |
| Keywords | AMQP, RabbitMQ, Controller, RPC |

## Links

- npm: https://www.npmjs.com/package/rabbitmq-rpc-client
- Repository: https://github.com/db3dev/amqp-rpc-client-controller
- Homepage: https://github.com/db3dev/amqp-rpc-client-controller#readme
- Issues: https://github.com/db3dev/amqp-rpc-client-controller/issues
- npm.io page: https://npm.io/package/rabbitmq-rpc-client

## Dependencies (2)

- [rx](https://npm.io/package/rx.md) ^4.1.0
- [amqplib](https://npm.io/package/amqplib.md) ^0.4.2

## Recent versions

- 1.0.1 (latest) — 2016-07-26
- 1.0.0 — 2016-07-26

## README

# amqp-rpc-client-controller
A client controller for sending asynchronous RPC requests over AMQP and RabbitMQ.

This client makes use of RxJs Observables for connection and response events.

# Connecting Without Subscriptions
```
// Require Client Module
var RPC = require('rpc-client');

// Configure Client to Connect to RabbitMQ Server

var config = RPC.Config({
    username: 'user',
    password: 'password',
    host: 'example.com',
    vhost: 'vhost'
});

// Start Client
var client = RPC.Client(config);

// Attempt to connect to server
client.connect();
```

# Connecting With a Subscription
```
// Require Client Module
var RPC = require('rpc-client');

// Configure Client to Connect to RabbitMQ Server
var config = RPC.Config({
    username: 'user',
    password: 'password',
    host: 'example.com',
    vhost: 'vhost'
});

// Start Client
var client = RPC.Client(config);

// Attempt to connect to server
client.connect().subscribe(
    (channel) => { ... }, // Actions after connection is made
    (err) => { ... } // Handle Error
)
```

# Sending a RPC Example
```
// Constant for the name of queue the RPC server is a member of
var QUEUENAME = 'api_queue';

// example object RPC server may be looking for
var message = {join: 'NewUsers'} 

// Send RPC to server and wait for a response to handle
client.rpcPush(QUEUENAME, message).subscribe(
    (res) => { console.log(res) },
    (err) => { console.error(err) }
);
```

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