Skip to content

Add RecoverableConnection interface #137

Closed
@doswell

Description

@doswell

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(); 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions