# amqparty

> making microservices fun with amqp

Latest version **0.0.1** (published 2015-05-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install amqparty
pnpm add amqparty
yarn add amqparty
bun add amqparty
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2015-05-30 |
| First published | 2015-05-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Gal Schlezinger |
| Maintainers | schlez |
| Keywords | amqp, microservices, services, micro, sugar, syntax |

## Links

- npm: https://www.npmjs.com/package/amqparty
- Repository: https://github.com/Schniz/amqparty
- Issues: https://github.com/Schniz/amqparty/issues
- npm.io page: https://npm.io/package/amqparty

## Dependencies (4)

- [amqp](https://npm.io/package/amqp.md) ^0.2.4
- [uuid](https://npm.io/package/uuid.md) ^2.0.1
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [bluebird](https://npm.io/package/bluebird.md) ^2.9.27

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2015-05-30
- 0.0.0 — 2015-05-30

## README

AMQParty
========
All I wanted was to build a great microservices using RabbitMQ.
but I can't understand all these terms... and all this boilerplate.. waaaa...

So lets party.

Installing
----------

```bash
npm install --save amqparty
```

Using
-----

```js
const amqparty = require('amqparty');

// Just connect with the amqp library settings
amqparty.connect({ ...amqpProperties }).then(() => {
  console.log("Connected..");
  const send = amqparty.sender({ exchange: 'joe', name: 'userInfo' });

  send({
    some: 'data',
    iWould: 'like to send'
  }).then(data => {
    console.log('got myself: ', data);
  }).catch(err => {
    console.error('oh noes: ', err);
  });
});
```

Handling data in a service
--------------------------

```js
const { connect, handle } = require('amqparty');

const listen = () => {
  console.log("Started...");
  handle({
    exchange: 'joe',
    name: 'userInfo'
  }, (data, resolve, reject) => {
    // Do your thing here...
    resolve({
      heyYou: 'ohai'
    });
  });
};

connect({ ...amqProperties }).then(listen);
```

How it works
------------

### sender
- creates a queue('joe', 'userInfo')
- returns a function that:
  - generates a uuid
  - add a subscriber to the subscribers object:
    - will call the callback
    - unbind the queue
    - remove the subscriber from the subscribers object
  - binds the queue to `userInfo.response.${uuid}`
  - sends data

### handle({ exchange: 'joe', name: 'userInfo' }, callback...)
creates a queue (`userInfo`) that binds to `userInfo.request`

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