Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
# [WIP] RabbitMQ AMQP 1.0 JavaScript Client

# NOT READY FOR PRODUCTION - The client is HEAVILY work in progress.

[![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)

This library is meant to be used with RabbitMQ 4.0.

# Table of Contents

- [Installing via NPM](#installing-via-npm)

- [Getting started](#getting-started)

- [Resources](#resources)

## Installing via npm

The client is distributed via **npm**:

```bash
npm install rabbitmq-amqp-js-client
```

## Getting started

**NOTE:** this is just a first example and will be replaced with the reference to the _examples folder_

```typescript
const environment = createEnvironment({
host: "localhost",
port: 5672,
username: "rabbit",
password: "rabbit",
})

const connection = await environment.createConnection()

const management = connection.management()

const queue = await management.declareQueue("test")

const exchange = await management.declareExchange("exchange", { type: "topic" })
const secondExchange = await management.declareExchange("exchange-dest", { type: "topic" })

const bindingToQueue = await management.bind("foo", { source: exchange, destination: queue })
const bindingToExchange = await management.bind("foo", { source: exchange, destination: secondExchange })

await management.unbind("foo", { source: exchange, destination: queue })
await management.unbind("foo", { source: exchange, destination: secondExchange })

await management.deleteExchange("exchange")
await management.deleteExchange("exchange-dest")
await management.deleteQueue("test")

management.close()
await connection.close()
await environment.close()
```

In this example we demonstrate how to create an environment, open a connection and use the management to create
or delete queues, exchanges and bindings.

## Resources

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