Consumer consumer = getOrCreateEndpoint(context).createConsumer();
if (StringUtils.hasText(messageSelector) && consumer instanceof SelectiveConsumer) {
receivedMessage = ((SelectiveConsumer)consumer).receive(messageSelector, context, timeout);
} else {
receivedMessage = consumer.receive(context, timeout);
}
if (receivedMessage != null) {
if (log.isDebugEnabled()) {
log.debug("Received message: " + receivedMessage.getPayload());