https://github.com/tada5hi/amqp-extension
This is a library on top of the amqplib library and is meant to simplify the process of consuming & publishing queue messages.
https://github.com/tada5hi/amqp-extension
abstraction-layer amqp rabbitmq typescript
Last synced: about 1 month ago
JSON representation
This is a library on top of the amqplib library and is meant to simplify the process of consuming & publishing queue messages.
- Host: GitHub
- URL: https://github.com/tada5hi/amqp-extension
- Owner: tada5hi
- License: mit
- Created: 2021-09-24T09:03:55.000Z (about 4 years ago)
- Default Branch: develop
- Last Pushed: 2025-08-12T13:50:42.000Z (about 2 months ago)
- Last Synced: 2025-08-16T07:31:31.254Z (about 2 months ago)
- Topics: abstraction-layer, amqp, rabbitmq, typescript
- Language: TypeScript
- Homepage:
- Size: 1.91 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.MD
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# AMQP Extension 🏰
[](https://badge.fury.io/js/amqp-extension)
[](https://codecov.io/gh/Tada5hi/amqp-extension)
[](https://github.com/Tada5hi/amqp-extension)
[](https://snyk.io/test/github/Tada5hi/amqp-extension?targetFile=package.json)
[](https://github.com/semantic-release/semantic-release)This is a library on top of the [amqplib](https://www.npmjs.com/package/amqplib) library and is meant to simplify the process of consuming & publishing queue messages.
**Table of Contents**
- [Installation](#installation)
- [Usage](#usage)
- [Publish](#publish)
- [Consume](#consume)
- [License](#license)## Installation
```bash
npm install amqp-extension --save
```## Usage
### Publish
The `publish` method allows you to send messages quickly.
```typescript
import { Client } from "amqp-extension";const client = new Client({
connectionOptions: 'amqp://:@',
exchange: {
name: '',
type: 'topic'
}
});(async () => {
await client.publish('', {
foo: 'bar'
});
})();
```### Consume
To consume a queue use the `consume` function.
```typescript
import {
Client,
ConsumeMessage,
ConsumeOptions,
} from "amqp-extension";const client = new Client({
connectionOptions: 'amqp://:@',
exchange: {
name: '',
type: 'topic'
}
});(async () => {
await client.consume('', {
$any: async (message: ConsumeMessage) => {
const content = message.content.toString('utf-8');
const payload = JSON.parse(content);
console.log(payload);
// { type: 'resourceCreated', name: 'foo' }
}
});
})();
```## License
Made with 💚
Published under [MIT License](./LICENSE).