RabbitMQ

RabbitMQ is an AMQP compatible transport that's officially supported by @node-ts/bus. Once configured, @node-ts/bus will create all necessary queues and exchanges to support the handlers of the application.

Installation

Install the @node-ts/bus-rabbitmq npm package

npm i @node-ts/bus-rabbitmq

Once installed, configure a new RabbitMqTransport and provide it to the bus configuration

import { Bus } from '@node-ts/bus-core'
import { RabbitMqTransport, RabbitMqTransportConfiguration } from '@node-ts/bus-rabbitmq'

const rabbitConfiguration: RabbitMqTransportConfiguration = {
  queueName: 'accounts-application-queue',
  connectionString: 'amqp://guest:guest@localhost',
  maxRetries: 5
}
const rabbitMqTransport = new RabbitMqTransport(rabbitConfiguration)
await Bus
  .configure()
  .withTransport(rabbitMqTransport)
  .initialize()

Last updated