Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectionFactory createConnection with automatic recovery returns Connection type #34

Closed
beeftornado opened this issue Mar 13, 2015 · 3 comments

Comments

@beeftornado
Copy link

Creating a connection through the connection factory with automatic recovery enabled returns the correct object (AutorecoveringConnection), but since the return type of the function is Connection, the methods in AutorecoveringConnection are unavailable without casting the return value, which isn't natural. In fact, most users are probably unaware that such a class even exists since it doesn't appear in website's API guide anywhere.

I don't know exactly how many differences there are, but I was specifically looking for the addRecoveryListener method. To not complicate things too much, a simple solution could be to expose the method in the Connection interface, but only implement it in AutorecoveringConnection.

@michaelklishin
Copy link
Member

Those methods are specific to AutorecoveringConnection and do not belong to the Connection interface unless we want to entirely disable non-recovering connections. This has been discussed and asking for a cast for class-specific functionality is not entirely unreasonable.

@beeftornado
Copy link
Author

Fair enough, I never liked casting, but I know it is just a personal preference. It really should at least be in the API guide so users know about the caveat.

@michaelklishin
Copy link
Member

Filed a separate issue for that.

@dumbbell dumbbell added this to the n/a milestone Mar 23, 2015
stream-iori pushed a commit to stream-iori/rabbitmq-java-client that referenced this issue Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants