Skip to content

Commit 82c73f6

Browse files
author
magne
committed
feat: add wip readme
1 parent 5cdee4e commit 82c73f6

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,70 @@
11
# [WIP] RabbitMQ AMQP 1.0 JavaScript Client
22

3+
# NOT READY FOR PRODUCTION - The client is HEAVILY work in progress.
4+
5+
[![Build Status](https://github.com/coders51/rabbitmq-amqp-js-client/actions/workflows/main.yml/badge.svg)](https://github.com/coders51/rabbitmq-amqp-js-client/actions)
6+
7+
This library is meant to be used with RabbitMQ 4.0.
8+
9+
# Table of Contents
10+
11+
- [Installing via NPM](#installing-via-npm)
12+
13+
- [Getting started](#getting-started)
14+
15+
- [Build from source](#build-from-source)
16+
17+
- [Resources](#resources)
18+
19+
- [Roadmap](#roadmap)
20+
21+
## Installing via npm
22+
23+
The client is distributed via **npm**:
24+
25+
```bash
26+
npm install rabbitmq-amqp-js-client
27+
```
28+
29+
## Getting started
30+
31+
**NOTE:** this is just a first example and will be replaced with the reference to the _examples folder_
32+
33+
```typescript
34+
const environment = createEnvironment({
35+
host: "localhost",
36+
port: 5672,
37+
username: "rabbit",
38+
password: "rabbit",
39+
})
40+
41+
const connection = await environment.createConnection()
42+
43+
const management = connection.management()
44+
45+
const queue = await management.declareQueue("test")
46+
47+
const exchange = await management.declareExchange("exchange", { type: "topic" })
48+
const secondExchange = await management.declareExchange("exchange-dest", { type: "topic" })
49+
50+
const bindingToQueue = await management.bind("foo", { source: exchange, destination: queue })
51+
const bindingToExchange = await management.bind("foo", { source: exchange, destination: secondExchange })
52+
53+
await management.unbind("foo", { source: exchange, destination: queue })
54+
await management.unbind("foo", { source: exchange, destination: secondExchange })
55+
56+
await management.deleteExchange("exchange")
57+
await management.deleteExchange("exchange-dest")
58+
await management.deleteQueue("test")
59+
60+
management.close()
61+
await connection.close()
62+
await environment.close()
63+
```
64+
65+
In this example we demonstrate how to create an environment, open a connection and use the management to create
66+
or delete queues, exchanges and bindings.
67+
368
## Resources
469

570
- [Reference library for AMQP 1.0](https://github.com/amqp/rhea)

0 commit comments

Comments
 (0)