Description
Reposting from https://groups.google.com/g/rabbitmq-users/c/k9eHUaptlRg
In the move from v5.0.0 to v6.0.0 of the .NET client, IAutoRecoveringConnection
was created to hold connection recovery events in #758. However it isn't possible to get hold of one via the public API, as ConnectionFactory.CreateConnection()
returns an IConnection
.
Is it worth considering a change to the public API to allow for returning an IAutoRecoveringConnection
? I can see two ways to do this:
-
Non breaking: create another method
ConnectionFactory.CreateAutoRecoveringConnection()
which returns anIAutoRecoveringConnection
. This would ignore whatever valueConnectionFactory.AutomaticRecoveryEnabled
is set to, however this could be confusing to API users. -
Breaking: Remove
ConnectionFactory.AutomaticRecoveryEnabled
, haveConnectionFactory.CreateConnection()
create aConnection
and return anIConnection
, and addConnectionFactory.CreateAutoRecoveringConnection()
which creates anAutoRecoveringConnection
and returns anIAutoRecoveringConnection
.
I'm not sure what would be preferred. Of course there may be a better solution that I haven't thought of.
At the moment we can work around this by checking if our IConnection
object is actually an IRecoveringConnection
, casting it and subscribing to the events, but I think it would be better to provide a proper way of getting an IRecoveringConnection
.