Example usage for com.rabbitmq.client RecoveryListener RecoveryListener

List of usage examples for com.rabbitmq.client RecoveryListener RecoveryListener

Introduction

In this page you can find the example usage for com.rabbitmq.client RecoveryListener RecoveryListener.

Prototype

RecoveryListener

Source Link

Usage

From source file:com.novemberain.langohr.Connection.java

License:Open Source License

public void onRecovery(final IFn f) {
    if (this.automaticRecoveryEnabled()) {
        ((AutorecoveringConnection) this.delegate).addRecoveryListener(new RecoveryListener() {
            public void handleRecovery(com.rabbitmq.client.Recoverable recoverable) {
                f.invoke(recoverable);/*from w w  w . ja  v a2 s .com*/
            }
        });
    }
}

From source file:reactor.rabbitmq.ConnectionRecoveryTests.java

License:Open Source License

private CountDownLatch prepareForRecovery(Connection conn) {
    final CountDownLatch latch = new CountDownLatch(1);
    ((AutorecoveringConnection) conn).addRecoveryListener(new RecoveryListener() {

        public void handleRecovery(Recoverable recoverable) {
            latch.countDown();// w  w  w . ja  v a2  s  .  com
        }

        public void handleRecoveryStarted(Recoverable recoverable) {
            // No-op
        }
    });
    return latch;
}