Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/amaui-org/amaui-amqp

AMQP
https://github.com/amaui-org/amaui-amqp

amaui amqp back-end backend js library node nodejs rabbitmq typescript utils web

Last synced: about 2 months ago
JSON representation

AMQP

Awesome Lists containing this project

README

        



amaui logo

amaui AMQP


AMQP



MIT license    
Production ready    
100% test cov    
Nodejs


Very simple code    
Modern code    
Junior friendly    
Typescript    
Made with :yellow_heart:


## Getting started

### Add

```sh
yarn add @amaui/amqp
```

Add `amqplib` peer dependency.

```sh
yarn add amqplib
```

### Use

```javascript
import AmauiAmqp from '@amaui/amqp';
// Make if you wanna a config file and
// inside of it add all the process.env related props
import Config from './config';

// Make a new amqp instance
const amauiAmqp = new AmauiAmqp({
uri: Config.amqp.rabbitmq.uri,
queues: Config.amqp.rabbitmq.queues,
exchanges: Config.amqp.rabbitmq.exchanges,
});

// Await for a channel
await amauiAmqp.channel;

// Send to a queue
await amauiAmqp.send('a', 'a');

// Check a queue
await amauiAmqp.checkQueue();

// { queue: 'a', messageCount: 1, etc. }
```

### Dev

Install

```sh
yarn
```

Test

```sh
yarn test
```

One time local setup

Install docker and docker-compose

- https://docs.docker.com/get-docker
- https://docs.docker.com/compose/install

Make docker containers

```sh
yarn docker
```

### Prod

Build

```sh
yarn build
```