List of usage examples for org.springframework.amqp.core MessageProperties setMessageCount
public void setMessageCount(Integer messageCount)
From source file:org.kurento.rabbitmq.RabbitTemplate.java
private Message buildMessageFromResponse(GetResponse response) { MessageProperties messageProps = this.messagePropertiesConverter.toMessageProperties(response.getProps(), response.getEnvelope(), this.encoding); messageProps.setMessageCount(response.getMessageCount()); return new Message(response.getBody(), messageProps); }
From source file:org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.java
/** * If this is a non-POISON non-null delivery simply return it. If this is * POISON we are in shutdown mode, throw shutdown. If delivery is null, we * may be in shutdown mode. Check and see. * //from w w w. ja va 2 s.c o m * @throws InterruptedException */ private Message handle(Delivery delivery) throws InterruptedException { if ((delivery == null && shutdown != null)) { throw shutdown; } if (delivery == null) { return null; } byte[] body = delivery.getBody(); Envelope envelope = delivery.getEnvelope(); MessageProperties messageProperties = this.messagePropertiesConverter .toMessageProperties(delivery.getProperties(), envelope, "UTF-8"); messageProperties.setMessageCount(0); Message message = new Message(body, messageProperties); if (logger.isDebugEnabled()) { logger.debug("Received message: " + message); } deliveryTags.add(messageProperties.getDeliveryTag()); int retryTimes = getRequeueTimes(message); retryDeliveryTags.put(messageProperties.getDeliveryTag(), ++retryTimes); return message; }