List of usage examples for org.springframework.amqp.rabbit.listener BlockingQueueConsumer rollbackOnExceptionIfNecessary
public void rollbackOnExceptionIfNecessary(Throwable ex)
From source file:org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.java
private boolean doReceiveAndExecute(BlockingQueueConsumer consumer) throws Throwable { Channel channel = consumer.getChannel(); for (int i = 0; i < this.txSize; i++) { logger.trace("Waiting for message from consumer."); Message message = consumer.nextMessage(this.receiveTimeout); if (message == null) { break; }//from w ww . ja v a 2s. co m try { executeListener(channel, message); } catch (ImmediateAcknowledgeAmqpException e) { break; } catch (Throwable ex) { //NOSONAR consumer.rollbackOnExceptionIfNecessary(ex); throw ex; } } return consumer.commitIfNecessary(isChannelLocallyTransacted(channel)); }