alpha-amqp-connection-manager
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

AMQP Connection manager

TypeScript CircleCI

Wrapper for amqplib connection that reconnects on failure.

Installation

Usage

import {connect} from 'alpha-amqp-connection-wrapper';

connect('amqp://your.connection:1010/string?heartbeat=10')
	.then((connection) => {
		connection.channel;
		connection.connection;
	})

Events

  • retry - on connection retry with number of retry attempt
  • connection-error - on internal connection error
  • connected - once connection established
  • disconnected - obvious
  • channel - once channel created
  • error - hard fail once we reach maximum amount of retry attempts

Configuration options

  • connection - any value provided to ampq.connect
  • useConfirmChannel - Whether to use confirm channel - default false
  • reconnect
    • failAfter - maximum amount of reconnect attempts - default no limit
    • backoffStrategy - backoff strategy to use. Note that alpha-amqp-connection-manager exports "backoff" module so you don't need to have it defined in your local package.json in order to use it.

Debugging

The library uses great debugFn package. Call your app with DEBUG env variable set in order to see debugFn messages.

DEBUG=alpha-amqp-connection-manager:*

Full API

Available as Typescript definition files

/alpha-amqp-connection-manager/

    Package Sidebar

    Install

    npm i alpha-amqp-connection-manager

    Weekly Downloads

    4

    Version

    0.3.1

    License

    MIT

    Unpacked Size

    31.3 kB

    Total Files

    9

    Last publish

    Collaborators

    • wookieb