Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wookieb/alpha-amqp-connection-manager
https://github.com/wookieb/alpha-amqp-connection-manager
alpha-packages amqp backoff connection-manager typescript
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/wookieb/alpha-amqp-connection-manager
- Owner: wookieb
- Created: 2017-05-28T17:10:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-27T15:10:21.000Z (over 2 years ago)
- Last Synced: 2024-11-08T03:40:20.558Z (about 2 months ago)
- Topics: alpha-packages, amqp, backoff, connection-manager, typescript
- Language: TypeScript
- Size: 127 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AMQP Connection manager
[![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.svg?v=101)](https://github.com/ellerbrock/typescript-badges/)
[![CircleCI](https://circleci.com/gh/wookieb/alpha-amqp-connection-manager.svg?style=svg)](https://circleci.com/gh/wookieb/alpha-amqp-connection-manager)Wrapper for [amqplib](https://github.com/squaremo/amqp.node) 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](https://www.npmjs.com/package/backoff#interface-backoffstrategy) 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](https://www.npmjs.com/package/debug) 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](./compiled/index.d.ts)