SimpleDispatcher no longer wraps a MessagingException inside of a MessageDeliveryException (part of INT-337).

This commit is contained in:
Mark Fisher
2008-08-18 19:04:46 +00:00
parent 4834c8a1b4
commit b4701c0150
3 changed files with 10 additions and 9 deletions

View File

@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageDeliveryException;
import org.springframework.integration.message.MessageHandlingException;
import org.springframework.integration.message.MessageRejectedException;
import org.springframework.integration.message.MessageTarget;
@@ -100,13 +99,13 @@ public class SimpleDispatcher extends AbstractDispatcher {
attempts++;
}
if (this.shouldFailOnRejectionLimit) {
throw new MessageDeliveryException(message, "Dispatcher reached rejection limit of " + this.rejectionLimit, lastException);
throw lastException;
}
return false;
}
private MessageHandlingException sendMessageToFirstAcceptingTarget(Message<?> message, Iterator<MessageTarget> iter) {
MessageHandlingException lastException = null;
MessageHandlingException exception = null;
int count = 0;
int rejectedExceptionCount = 0;
while (iter.hasNext()) {
@@ -127,7 +126,9 @@ public class SimpleDispatcher extends AbstractDispatcher {
}
}
catch (MessageHandlingException e) {
lastException = e;
if (exception == null) {
exception = e;
}
if (logger.isDebugEnabled()) {
logger.debug("Target '" + target + "' threw an exception, continuing with other targets if available.", e);
}
@@ -136,7 +137,7 @@ public class SimpleDispatcher extends AbstractDispatcher {
if (rejectedExceptionCount == count) {
throw new MessageRejectedException(message, "All of dispatcher's targets rejected Message.");
}
return lastException;
return exception;
}
private void waitBetweenAttempts(int attempts) throws InterruptedException {