use of org.springframework.integration.support.MessagingExceptionWrapper in project spring-integration by spring-projects.
the class AbstractPollingEndpoint method doPoll.
private boolean doPoll() {
IntegrationResourceHolder holder = this.bindResourceHolderIfNecessary(this.getResourceKey(), this.getResourceToBind());
Message<?> message = null;
try {
message = this.receiveMessage();
} catch (Exception e) {
if (Thread.interrupted()) {
if (logger.isDebugEnabled()) {
logger.debug("Poll interrupted - during stop()? : " + e.getMessage());
}
return false;
} else {
throw (RuntimeException) e;
}
}
boolean result;
if (message == null) {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Received no Message during the poll, returning 'false'");
}
result = false;
} else {
if (this.logger.isDebugEnabled()) {
this.logger.debug("Poll resulted in Message: " + message);
}
if (holder != null) {
holder.setMessage(message);
}
try {
this.handleMessage(message);
} catch (Exception e) {
if (e instanceof MessagingException) {
throw new MessagingExceptionWrapper(message, (MessagingException) e);
} else {
throw new MessagingException(message, e);
}
}
result = true;
}
return result;
}
Aggregations