JSPM

  • Created
  • Published
  • Downloads 111
  • Score
    100M100P100Q80928F
  • License MIT

A RabbitMQ transport adapter for @node-ts/bus-core.

Package Exports

  • @node-ts/bus-rabbitmq
  • @node-ts/bus-rabbitmq/dist/rabbitmq-transport

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@node-ts/bus-rabbitmq) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@node-ts/bus-rabbitmq

Known Vulnerabilities CircleCILicense: MIT

A rabbitmq transport adapter for @node-ts/bus.

Installation

Install all packages and their dependencies

npm i reflect-metadata inversify @node-ts/bus-rabbitmq @node-ts/bus-core

Once installed, load the BusRabbitMqModule to your inversify container alongside the other modules it depends on:

import { Container } from 'inversify'
import { LoggerModule } from '@node-ts/logger-core'
import { BusModule } from '@node-ts/bus-core'
import { BUS_RABBITMQ_SYMBOLS, BusRabbitMqModule, RabbitMqTransportConfiguration } from '@node-ts/bus-rabbitmq'

const container = new Container()
container.load(new LoggerModule())
container.load(new BusModule())
container.load(new BusRabbitMqModule())

const rabbitConfiguration: RabbitMqTransportConfiguration = {
  queueName: 'accounts-application-queue',
  connectionString: 'amqp://guest:guest@localhost',
  maxRetries: 5
}
container.bind(BUS_RABBITMQ_SYMBOLS.TransportConfiguration).toConstantValue(rabbitConfiguration)

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