Skip to content

Commit d01efd7

Browse files
authored
Merge pull request #22 from coders51/21-as-a-developer-i-want-to-add-a-basic-readme
[IS-21/feat]: add wip readme
2 parents 5cdee4e + a5e45af commit d01efd7

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,66 @@
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+
- [Resources](#resources)
16+
17+
## Installing via npm
18+
19+
The client is distributed via **npm**:
20+
21+
```bash
22+
npm install rabbitmq-amqp-js-client
23+
```
24+
25+
## Getting started
26+
27+
**NOTE:** this is just a first example and will be replaced with the reference to the _examples folder_
28+
29+
```typescript
30+
const environment = createEnvironment({
31+
host: "localhost",
32+
port: 5672,
33+
username: "rabbit",
34+
password: "rabbit",
35+
})
36+
37+
const connection = await environment.createConnection()
38+
39+
const management = connection.management()
40+
41+
const queue = await management.declareQueue("test")
42+
43+
const exchange = await management.declareExchange("exchange", { type: "topic" })
44+
const secondExchange = await management.declareExchange("exchange-dest", { type: "topic" })
45+
46+
const bindingToQueue = await management.bind("foo", { source: exchange, destination: queue })
47+
const bindingToExchange = await management.bind("foo", { source: exchange, destination: secondExchange })
48+
49+
await management.unbind("foo", { source: exchange, destination: queue })
50+
await management.unbind("foo", { source: exchange, destination: secondExchange })
51+
52+
await management.deleteExchange("exchange")
53+
await management.deleteExchange("exchange-dest")
54+
await management.deleteQueue("test")
55+
56+
management.close()
57+
await connection.close()
58+
await environment.close()
59+
```
60+
61+
In this example we demonstrate how to create an environment, open a connection and use the management to create
62+
or delete queues, exchanges and bindings.
63+
364
## Resources
465

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

0 commit comments

Comments
 (0)