Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prismamedia/ts-amqp-client
This module aims to ease the communication with a broker using the AMQP protocol, it provides some low-level tools.
https://github.com/prismamedia/ts-amqp-client
Last synced: 8 days ago
JSON representation
This module aims to ease the communication with a broker using the AMQP protocol, it provides some low-level tools.
- Host: GitHub
- URL: https://github.com/prismamedia/ts-amqp-client
- Owner: prismamedia
- License: mit
- Created: 2020-09-18T16:16:15.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-11T08:16:51.000Z (almost 3 years ago)
- Last Synced: 2024-10-28T16:02:55.308Z (17 days ago)
- Language: TypeScript
- Size: 109 MB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
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 payloadack();
},
);// [...]
await client.stopConsumer(consumerId, true);
} catch (err) {
// Handle error
}
```