@bakerstreet-industries/bus-rabbitmq
TypeScript icon, indicating that this package has built-in type declarations

1.0.16 • Public • Published

@node-ts/bus-rabbitmq

A Rabbit MQ transport adapter for @node-ts/bus

🔥 View our docs at https://bus.node-ts.com 🔥

🤔 Have a question? Join our Discord 🤔

Installation

Install all packages and their dependencies

npm install @node-ts/bus-rabbitmq

Once installed, configure a new RabbitMqTransport and register it for use with Bus:

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)

// Configure Bus to use RabbitMQ as a transport
const run = async () => {
  await Bus
    .configure()
    .withTransport(rabbitMqTransport)
    .initialize()
}
run.catch(console.error)

Configuration Options

The RabbitMQ transport has the following configuration:

  • queueName (required) The name of the service queue to create and read messages from.
  • connectionString (required) An amqp formatted connection string that's used to connect to the RabbitMQ instance
  • maxRetries (optional) The number of attempts to retry failed messages before they're routed to the dead letter queue. Default: 10

Development

Local development can be done with the aid of docker to run the required infrastructure. To do so, run:

docker run -d -p 8080:15672 -p 5672:5672 rabbitmq:3-management

Package Sidebar

Install

npm i @bakerstreet-industries/bus-rabbitmq

Weekly Downloads

1

Version

1.0.16

License

MIT

Unpacked Size

35.4 kB

Total Files

18

Last publish

Collaborators

  • roustalski