Alpha AMQP Consumer
Library for reliable message consumption via AMQP protocol.
- Automatically reconnects and restores channels for consumers
- Super easy to use
- Ability to stop/resume consumption
- Supports queue <-> exchange binding
- Supports queue assertion
- Allows to retry message consumption after certain amount of time
- Maintains counter of ongoing consumptions which helps implement graceful app shutdown
- Easy debugging with debug module
npm install alpha-amqp-consumer
const connect = ;;
Usage with promises
// (...)manager;// (...)
Message ACK-ing and REJECT-ing
Every consumer has "resultHandler" which a function that decides what to do with the messages based on the result from consumer function. Message is rejected automatically it consumer function throws an error or returned promise gets rejected, otherwise message is ACKed. You can customize the behavior by providing resultHandler
Retry with delay
There is no way to say AMQP to retry message consumption after certain period of time. In order to achieve that we need a bit more typology setup.
- name of "pre" retry exchange
- name of "post-retry" exchange
- name of queue for temporary messages storage
For more information how retry works another document.
Run your app with DEBUG env variable. See debug package docs for more details.
DEBUG=alpha-amqp-consumer:* node app.js
- Added extra exported types
- "channel" and "retryTopology" for ConsumerManager are now public
- "ConnectionManagerOptions" interface exported