RMQ .NET Client IAutoRecoveringConnection

204 views
Skip to first unread message

Alex D

unread,
Sep 11, 2020, 10:43:30 AM9/11/20
to rabbitmq-users
Hi there!

I wasn't sure if I should create an issue on GitHub or post here, I've posted here to be on the safe side as this is a discussion at the moment.

In the move from v5.0.0 to v6.0.0 of the .NET client, IAutoRecoveringConnection was created to hold connection recovery events in https://github.com/rabbitmq/rabbitmq-dotnet-client/pull/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 an IAutoRecoveringConnection. This would ignore whatever value ConnectionFactory.AutomaticRecoveryEnabled is set to, however this could be confusing to API users.
  • Breaking: Remove ConnectionFactory.AutomaticRecoveryEnabled and have ConnectionFactory.CreateConnection() create a Connection and return an IConnection, and add ConnectionFactory.CreateAutoRecoveringConnection() which creates an AutoRecoveringConnection and returns an IAutoRecoveringConnection.
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.

Hopefully my rambling has made sense! Please let me know if I should post this on GitHub instead.

Many thanks,
Alex


Luke Bakken

unread,
Sep 11, 2020, 11:36:29 AM9/11/20
to rabbitmq-users
Hi Alex,

Thanks for posting this here first. If you don't mind re-posting as a GitHub issue, that would be great. There are several community contributors whose opinion I would like to get.

Thanks!
Luke

Alex D

unread,
Sep 11, 2020, 12:15:42 PM9/11/20
to rabbitmq-users
Reply all
Reply to author
Forward
0 new messages