Skip to content

Discussion: recovery events for automatically recovering connections (IAutoRecoveringConnection) #940

Closed
@alexdougie

Description

@alexdougie

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 an IAutoRecoveringConnection. This would ignore whatever value ConnectionFactory.AutomaticRecoveryEnabled is set to, however this could be confusing to API users.

  • Breaking: Remove ConnectionFactory.AutomaticRecoveryEnabled, 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions