@rabbitmq-ts/core
TypeScript icon, indicating that this package has built-in type declarations

2.0.3 • Public • Published

A wrapper of amqp-connection-manager for Node.JS.

Install

npm install --save @rabbitmq-ts/core

# or

yarn add @rabbitmq-ts/core

# or

pnpm add @rabbitmq-ts/core

Usage

import { Connection } from '@rabbitmq-ts/core';
import type { ChannelWrapper } from '@rabbitmq-ts/core';

(async function test() {
  const connection = new Connection({
    urls: {
      host: process.env.RABBITMQ_HOST,
      port: process.env.RABBITMQ_PORT,
      username: process.env.RABBITMQ_USERNAME,
      password: process.env.RABBITMQ_PASSWORD,
      virtualHost: process.env.RABBITMQ_VIRTUAL_HOST,
    },
  });

  const channel = connection.createChannel();

  await channel.assertExchange('exchange_name', 'topic');

  await channel.publish('exchange_name', 'routing_key', {
    message: 'test message',
  });

  channel.close();
  connection.close();
})();

Package Sidebar

Install

npm i @rabbitmq-ts/core

Weekly Downloads

4

Version

2.0.3

License

MIT

Unpacked Size

9.42 kB

Total Files

9

Last publish

Collaborators

  • zgid123