bloomberg / blazingmq-sdk-java

Java SDK for BlazingMQ, a modern high-performance open source message queuing system.
https://bloomberg.github.io/blazingmq
Apache License 2.0
26 stars 13 forks source link

Do not throw UnknownHostException #13

Closed sgalichkin closed 1 year ago

sgalichkin commented 1 year ago

Original issue description Integration test (not available here). The broker runs in docker container, then goes down and corresponding DNS entry becomes unavailable. After the first attempt to reconnect the NettyTcpConnection gets UnknownHostException from NetResolver and fails to schedule next reconnection attempt.

Describe your changes Modify NetResolver to not throw UnknownHostException. This way NettyTcpConnection may continue its attempts to (re)connect even if there are temporarily DNS issues (which may disappear in a second).

The proposed solution is not perfect. Ideally, in case of unknown host it's better to skip connection attempt at all and just schedule the next one but this will require to modify NettyTcpConnection (connect/disconnect callbacks) and corresponding tests.

Testing performed Manually tested by starting/stopping broker and modifying /etc/hosts records