List of usage examples for com.rabbitmq.client GetResponse getMessageCount
public int getMessageCount()
From source file:com.kurento.kmf.rabbitmq.RabbitTemplate.java
License:Apache License
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.apache.flume.rabbitmq.source.RabbitMQSource.java
License:Apache License
private Event readEvent() throws IOException { GetResponse response; response = channel.getChannel().basicGet(queueName, false); if (response == null) { logger.debug("No event to read from MQ"); counterGroup.incrementAndGet(COUNTER_EMPTY_MQ_GET); return null; }// w w w. j a va 2 s. c o m logger.info("received event: {} bytes", response.getBody().length); if (response.getEnvelope() != null) { logger.debug("Envelope: {}", response.getEnvelope()); } if (response.getProps() != null && response.getProps().getHeaders() != null) { logger.debug("Header: {}", response.getProps().getHeaders().toString()); } logger.debug("Message: {}", new String(response.getBody())); counterGroup.incrementAndGet(COUNTER_SUCCESS_MQ_GET); isMoreMessagesOnServer = (response.getMessageCount() > 0); Map<String, String> eventHeader = createEventHeader(response); Event event = EventBuilder.withBody(response.getBody(), eventHeader); return event; }