0.8.1 • Published 4 years ago

ts-amqp v0.8.1

Weekly downloads
109
License
MIT
Repository
-
Last release
4 years ago

AMQP 0-9-1 client library for Node

ts-amqp is a modern library for communicating with AMQP 0-9-1 servers (e.g. RabbitMQ) from NodeJS applications. It is built with TypeScript and heavily uses Node's streams.

Install

npm i ts-amqp

Examples

For publishing a JSON message to an exchange:

const conn = new Connection({
    maxRetries: 30,
    retryDelay: 1000
});

await conn.start();

const ch = await conn.channel();

await ch.declareQueue({
    name: 'movies',
    durable: true,
    auto_delete: false,
    exclusive: false,
    arguments: {}
});

ch.json.write({
    routing_key: 'movies',
    body: {
        message: 'Hello, World!'
    }
});

await conn.close();

For consuming from a queue:

const conn = new Connection({
    maxRetries: 30,
    retryDelay: 1000
});

await conn.start();
const ch = await conn.channel();

await ch.declareQueue({
    name: 'movies',
    durable: true,
    auto_delete: false,
    exclusive: false,
    arguments: {}
});

const consumer = await ch.basicConsume('movies');

consumer.pipe(
    new Transform({
        objectMode: true,
        transform(chunk, _encoding, cb) {
            console.log(chunk.body.toString('utf-8'))
            cb();
        }
    })
)
0.8.1

4 years ago

0.7.6

6 years ago

0.7.5

6 years ago

0.7.4

6 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.0

6 years ago

0.6.23

6 years ago

0.6.22

6 years ago

0.6.21

6 years ago

0.6.20

6 years ago

0.6.19

6 years ago

0.6.18

6 years ago

0.6.17

6 years ago

0.6.16

6 years ago

0.6.15

6 years ago

0.6.14

6 years ago

0.6.13

6 years ago

0.6.12

6 years ago

0.6.11

6 years ago

0.6.10

6 years ago

0.6.9

6 years ago

0.6.8

6 years ago

0.6.7

6 years ago

0.6.6

6 years ago

0.6.5

6 years ago

0.6.4

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.3.0

6 years ago

0.2.3

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago