golevelup / nestjs

A collection of badass modules and utilities to help you level up your NestJS applications 🚀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RabbitMQ publish doesn't take advantage of amqp-connection-manager's reliable publish

ttshivers opened this issue · comments

The rabbitmq package's publish implementation calls publish on a raw ConfirmChannel instead of the ChannelWrapper provided by amqp-connection-manager.

Since it's not using the ChannelWrapper, it's missing out on all the reliability features that amqp-connection-manager provides for publishing messages.

Was this an intentional decision to not use the ChannelWrapper ?

return new Promise((resolve, reject) => {
this._channel.publish(
exchange,
routingKey,
buffer,
options,
(err, ok) => {
if (err) {
reject(err);
} else {
resolve(ok);
}
}
);
});
}

Instead of using this._channel there, this._managedChannel could be used instead which is the ChannelWrapper

@ttshivers If you feel confident about this change and can provide test coverage to assert that it works as intended I'll be happy to review and merge.
I don't know what the reason was behind not to use ChannelWrapper but from your explanation it seems logical to use so

Fixed by #678