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

Add RecoverableConnection interface #137

Closed
doswell opened this issue Mar 9, 2016 · 1 comment
Closed

Add RecoverableConnection interface #137

doswell opened this issue Mar 9, 2016 · 1 comment
Assignees
Milestone

Comments

@doswell
Copy link

doswell commented Mar 9, 2016

As a thought for 3.7.0, add a RecoverableConnection interface such as;
public interface RecoverableConnection extends Connection, Recoverable { }
And update AutorecoveringConnection as;
public class AutorecoveringConnection implements RecoverableConnection, NetworkConnection {

This just makes casting and using a recoverable connection a bit easier than casting to either just Recoverable (which just exposes the two methods) or the concrete class.

ie, instead of;

factory.setAutomaticRecoveryEnabled(true);
Connection connection = factory.newConnection();
connection.addShutdownListener(...);
((Recoverable)connection).addRecoveryListener(...); 

Would be;

factory.setAutomaticRecoveryEnabled(true);
RecoverableConnection connection = (RecoverableConnection)factory.newConnection();
connection.addShutdownListener(...);
connection.addRecoveryListener(...);

Similar could be done for RecoverableChannel

A newRecoverableConnection(...) method on factory may also make ones intent very clear as well, although not necessary.

RecoverableConnection connection = factory.newRecoverableConnection(); 
@michaelklishin
Copy link
Member

Relevant to #132, #135, #136.

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

4 participants
@michaelklishin @acogoluegnes @doswell and others