Fixes For Final Spring 4 Polishing
- MessageConverter moved - MessagingException.failedMessage is immutable - Cast needed on messagingTemplate.receive()
This commit is contained in:
@@ -144,7 +144,7 @@ public class BroadcastingDispatcher extends AbstractDispatcher {
|
||||
catch (RuntimeException e) {
|
||||
if (!this.ignoreFailures) {
|
||||
if (e instanceof MessagingException && ((MessagingException) e).getFailedMessage() == null) {
|
||||
((MessagingException) e).setFailedMessage(message);
|
||||
throw new MessagingException(message, e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class UnicastingDispatcher extends AbstractDispatcher {
|
||||
"Dispatcher failed to deliver Message.", e);
|
||||
if (e instanceof MessagingException &&
|
||||
((MessagingException) e).getFailedMessage() == null) {
|
||||
((MessagingException) e).setFailedMessage(message);
|
||||
runtimeException = new MessagingException(message, e);
|
||||
}
|
||||
exceptions.add(runtimeException);
|
||||
this.handleExceptions(exceptions, message, !handlerIterator.hasNext());
|
||||
|
||||
@@ -89,7 +89,7 @@ public class RequestHandlerRetryAdvice extends AbstractRequestHandlerAdvice
|
||||
}
|
||||
catch (MessagingException e) {
|
||||
if (e.getFailedMessage() == null) {
|
||||
e.setFailedMessage(message);
|
||||
throw new MessagingException(message, e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Map;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.support.converter.MessageConverter;
|
||||
import org.springframework.messaging.converter.MessageConverter;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,8 +21,8 @@ import org.springframework.integration.mapping.OutboundMessageMapper;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.support.converter.MessageConversionException;
|
||||
import org.springframework.messaging.support.converter.MessageConverter;
|
||||
import org.springframework.messaging.converter.MessageConversionException;
|
||||
import org.springframework.messaging.converter.MessageConverter;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
|
||||
@@ -19,15 +19,18 @@ package org.springframework.integration.endpoint;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessagingException;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
import org.springframework.messaging.core.DestinationResolutionException;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
@@ -98,14 +101,19 @@ public class ReturnAddressTests {
|
||||
assertNull(channel2.receive(0));
|
||||
}
|
||||
|
||||
@Test(expected = DestinationResolutionException.class)
|
||||
@Test
|
||||
public void returnAddressFallbackButNotAvailable() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
|
||||
"returnAddressTests.xml", this.getClass());
|
||||
MessageChannel channel3 = (MessageChannel) context.getBean("channel3");
|
||||
context.start();
|
||||
GenericMessage<String> message = new GenericMessage<String>("*");
|
||||
channel3.send(message);
|
||||
try {
|
||||
channel3.send(message);
|
||||
}
|
||||
catch (MessagingException e) {
|
||||
assertTrue(e.getCause() instanceof DestinationResolutionException);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user