# @prismamedia/amqp-client

Latest version **6.0.1** (published 2022-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @prismamedia/amqp-client
pnpm add @prismamedia/amqp-client
yarn add @prismamedia/amqp-client
bun add @prismamedia/amqp-client
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.1 |
| Published | 2022-01-11 |
| First published | 2017-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 3 |
| Unpacked size | 87.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | prismamedia, yvann |

## Links

- npm: https://www.npmjs.com/package/@prismamedia/amqp-client
- Repository: https://github.com/prismamedia/ts-amqp-client
- npm.io page: https://npm.io/package/@prismamedia/amqp-client

## Dependencies (3)

- [amqplib](https://npm.io/package/amqplib.md) ^0.8.0
- [@types/amqplib](https://npm.io/package/@types/amqplib.md) ^0.8.2
- [@prismamedia/ts-typed-event-emitter](https://npm.io/package/@prismamedia/ts-typed-event-emitter.md) ^1.0.2

## Recent versions

- 6.0.1 (latest) — 2022-01-11
- 6.0.0 — 2021-06-29
- 5.1.7 — 2020-10-07
- 5.1.6 — 2020-10-05
- 5.1.5 — 2020-10-05
- 5.1.4 — 2020-10-04
- 5.1.3 — 2020-10-02
- 5.1.2 — 2020-09-30
- 5.1.1 — 2020-09-30
- 5.1.0 — 2020-09-30
- 5.0.0 — 2020-09-30
- 5.0.0-beta.6 — 2020-09-26
- 5.0.0-beta.5 — 2020-09-26
- 5.0.0-beta.4 — 2020-09-24
- 5.0.0-beta.3 — 2020-09-24
- … 25 more at https://npm.io/package/@prismamedia/amqp-client/versions

## README

# AMQP Client

## About

This module aims to ease the communication with a broker using the AMQP protocol, it provides some low-level tools.

## Getting started

## Prerequisites

This module requires Node 14 and a connection to an AMQP broker

## Installation

```javascript
import Client from '@prismamedia/amqp-client';
// or : Client = require('@prismamedia/amqp-client');
```

## Configuration

```javascript
const client = new Client('amqp://rabbitmq/');
```

## Usage

```javascript
const payload = { ... };

try {
  await client.publish('', 'queue_name', payload);
} catch (err) {
  // Handle error
}
```

```javascript
try {
  const consumerId = await client.consume(
    'queue_name',
    (message, payload, ack) => {
      // Do what you want with the full AMQP message or with the Object payload

      ack();
    },
  );

  // [...]

  await client.stopConsumer(consumerId, true);
} catch (err) {
  // Handle error
}
```

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