Example usage for org.springframework.amqp.rabbit.connection RabbitResourceHolder rollbackAll

List of usage examples for org.springframework.amqp.rabbit.connection RabbitResourceHolder rollbackAll

Introduction

In this page you can find the example usage for org.springframework.amqp.rabbit.connection RabbitResourceHolder rollbackAll.

Prototype

public void rollbackAll() 

Source Link

Usage

From source file:org.kurento.rabbitmq.RabbitTemplate.java

private <T> T doExecute(ChannelCallback<T> action) {
    Assert.notNull(action, "Callback object must not be null");
    RabbitResourceHolder resourceHolder = getTransactionalResourceHolder();
    Channel channel = resourceHolder.getChannel();
    if (this.confirmCallback != null || this.returnCallback != null) {
        addListener(channel);//from www.j a va2s . c om
    }
    try {
        if (logger.isDebugEnabled()) {
            logger.debug("Executing callback on RabbitMQ Channel: " + channel);
        }
        return action.doInRabbit(channel);
    } catch (Exception ex) {
        if (isChannelLocallyTransacted(channel)) {
            resourceHolder.rollbackAll();
        }
        throw convertRabbitAccessException(ex);
    } finally {
        ConnectionFactoryUtils.releaseResources(resourceHolder);
    }
}