List of usage examples for org.springframework.amqp.rabbit.listener BlockingQueueConsumer nextMessage
@Nullable public Message nextMessage(long timeout) throws InterruptedException, ShutdownSignalException
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; }// w w w .ja va 2s . c o m try { executeListener(channel, message); } catch (ImmediateAcknowledgeAmqpException e) { break; } catch (Throwable ex) { //NOSONAR consumer.rollbackOnExceptionIfNecessary(ex); throw ex; } } return consumer.commitIfNecessary(isChannelLocallyTransacted(channel)); }