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

Failover scenario not supported #5

Closed pzamzow closed 3 years ago

pzamzow commented 4 years ago

Hi,

first thanks for this great NestJS module.

I tried to use it in one of my projects to connect to Azure service bus and Amazon MQ. On Amazon I have an active/standby setup. This means multiple servers are running, but the connection to just one of them is possible at a time. The other will refuse the connection. As by the comment given in amqp/rhea/issues#124, I need to use the connection_details function to support this. This did not worked for me, when using this module, because the client factory throws an error on the first connection attempt to the not active server. After that no attempt to the second (active) server is triggered.

I could solve this issue by adding a try/catch to your factory function, but it would be nice, if this would be supported by the module itself.

tahubu commented 4 years ago

Hi @pzamzow

thank you for your feedback. In version 1.1.0 we added a new connection option called throwExceptionOnConnectionError which value is false by default. I think this option with false can solve your problem.

pzamzow commented 3 years ago

@tahubu thanks a lot for this enhancement. I implemented it and it is working as expected.