if (LOG.isDebugEnabled()) {
LOG.debug("Fetching {} messages. Total {} messages.", count, messages.length);
}
for (int i = 0; i < count; i++) {
Message message = messages[i];
if (LOG.isTraceEnabled()) {
LOG.trace("Mail #{} is of type: {} - {}", new Object[]{i, ObjectHelper.classCanonicalName(message), message});
}
if (!message.getFlags().contains(Flags.Flag.DELETED)) {
Exchange exchange = getEndpoint().createExchange(message);
if (getEndpoint().getConfiguration().isMapMailMessage()) {
// ensure the mail message is mapped, which can be ensured by touching the body/header/attachment
LOG.trace("Mapping #{} from javax.mail.Message to Camel MailMessage", i);
exchange.getIn().getBody();