Example usage for com.rabbitmq.client Channel clearConfirmListeners

List of usage examples for com.rabbitmq.client Channel clearConfirmListeners

Introduction

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

Prototype

void clearConfirmListeners();

Source Link

Document

Remove all ConfirmListener s.

Usage

From source file:org.mule.transport.amqp.DefaultAmqpConfirmsManager.java

License:Open Source License

public boolean awaitConfirm(Channel channel, MuleEvent event, long timeout, TimeUnit timeUnit) {
    try {/*from ww w.j  a va2s. c  o  m*/
        if (!handlesConfirms()) {
            return true;
        }

        Long seqNo = event.getFlowVariable(AmqpConstants.NEXT_PUBLISH_SEQ_NO);
        if (seqNo == null) {
            throw new IllegalStateException("Event is missing publish sequence number");
        }

        ConfirmHandler confirmHandler = pendingConfirms.get(seqNo);
        if (confirmHandler != null) {
            return confirmHandler.awaitConfirmation(timeout, timeUnit);
        } else {
            return false;
        }
    } finally {
        channel.clearConfirmListeners();
    }
}

From source file:org.mule.transport.amqp.internal.confirm.DefaultConfirmsManager.java

License:Open Source License

public boolean awaitConfirm(Channel channel, MuleEvent event, long timeout, TimeUnit timeUnit) {
    try {/*from   w  ww.  j a v a  2 s . co  m*/
        if (!handlesConfirms()) {
            return true;
        }

        Long seqNo = event.getFlowVariable(AmqpConnector.MESSAGE_PROPERTY_NEXT_PUBLISH_SEQ_NO);
        if (seqNo == null) {
            throw new IllegalStateException("Event is missing publish sequence number");
        }

        ConfirmHandler confirmHandler = pendingConfirms.get(seqNo);
        if (confirmHandler != null) {
            return confirmHandler.awaitConfirmation(timeout, timeUnit);
        } else {
            return false;
        }
    } finally {
        channel.clearConfirmListeners();
    }
}