team-supercharge / nest-amqp

Nest AMQP 1.0 module - NPM package: https://www.npmjs.com/package/@team-supercharge/nest-amqp
https://supercharge.io
MIT License
26 stars 13 forks source link

Need for failover/reconnect or expose AMQService #74

Open radoslawlandowski opened 8 months ago

radoslawlandowski commented 8 months ago

Hello!

I'm in need of implementing the failover on the client side. In the other issue (#72 ) you mention it's not supported in rhea-as-promised. It is however supported in regular 'rhea': https://github.com/amqp/rhea/blob/main/examples/reconnect/client.js#L43

If you exposed AMQPService from the module I could listen to connectionClosed event and reconnect to another broker URI.

With current exports from the module, I can only consider to reload the NestJS module in runtime whenever connectionClose appears. It's an idea I do not specifically like :(

Any advice on how I could make the failover logic work with your module? :)

Best regards, Radek