valtech-sd / amqp-cacoon

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

Closed EricWasTakenMJD closed 3 years ago

EricWasTakenMJD commented 3 years ago

The project does not have an example other than the bits in the README, which are not complete.

For the example:

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)}`);
    }
  },
});
EricWasTakenMJD commented 3 years ago

This is handling this: https://github.com/valtech-sd/amqp-cacoon/pull/25