AmqpCacoon is an abstraction around node-amqp-connection-manager that provides a simple interface with flow control, retries, reconnects, and more included out of the box.
MIT License
5
stars
4
forks
source link
The README is very outdated, the examples in the README are unclear and do not work + the project lacks a complete example #23
The example should show how to pass a TLS CA CERT to a server (a common pattern for using TLS.)
The example code does not work. In fact, since the change to node-amqp-connection-manager, the assertQueue in the examples won't work as documented.
The README does not reference how to use "onChannelConnect" to pass what node-amqp calls "setup" and that asserQueues must be done at this level. (see below).
Example constructor WITH onChannelConnect:
let amqpCacoon = new AmqpCacoon({
protocol: config.messageBus.protocol,
username: config.messageBus.username,
password: config.messageBus.password,
host: config.messageBus.host,
port: config.messageBus.port,
amqp_opts: {},
providers: {
logger: logger,
},
onChannelConnect: async (channel) => {
// Very important to try/catch here, otherwise channel setup errors will just fail silently!!
try {
await channel.assertQueue(amqpConfig.exampleQueue, {
autoDelete: true,
durable: false,
});
} catch (ex) {
logger.error(`onChannelConnect ERROR: ${util.inspect(ex.message)}`);
}
},
});
The project does not have an example other than the bits in the README, which are not complete.
For the example:
.default
. See https://github.com/valtech-sd/amqp-cacoon/issues/21Example constructor WITH onChannelConnect: