Using exceptions as normal control flow when connecting

21 views
Skip to first unread message

JerMah

unread,
Jul 6, 2020, 10:08:56 AM7/6/20
to rabbitmq-users
When starting my application, which uses RabbitMQ client, in Visual Studio, I always yet a few exceptions from RabbitMQ before it actually starts. These exceptions are user handled so there's no real problem, continuing execution eventually get through them. The particular problem is discussed in https://stackoverflow.com/a/59495708/1560347 .
In this particular case the RabbitMQ client first tries to connect over IPv6 and later over IPv4. IPv6 doesn't work and internally gives an exception before switching to IPv4.

This is annoying above anything else. There's probably some miniscule performance loss aswell. Should rabbitmq rely on exceptions for normal program execution? Is this something worth making a pull request for?

Michael Klishin

unread,
Jul 6, 2020, 12:46:02 PM7/6/20
to rabbitmq-users
The client does not do anything particularly clever. It tries two ways of connecting each of which may fail.

If there is a way to detect IPv6 vs. IPv4 availability and preference, we would consider a PR but I somewhat doubt
it would be more reliable than catching an exception.

This is not a problem I'd spend any time on, to be honest. There are much bigger ones, including in the .NET client specifically.
Reply all
Reply to author
Forward
0 new messages