use of org.springframework.messaging.core.DestinationResolutionException in project spring-integration by spring-projects.
the class ReturnAddressTests method returnAddressFallbackButNotAvailable.
@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>("*");
try {
channel3.send(message);
} catch (MessagingException e) {
assertTrue(e.getCause() instanceof DestinationResolutionException);
}
context.close();
}
use of org.springframework.messaging.core.DestinationResolutionException in project spring-integration by spring-projects.
the class AbstractMethodAnnotationPostProcessor method createEndpoint.
protected AbstractEndpoint createEndpoint(MessageHandler handler, Method method, List<Annotation> annotations) {
AbstractEndpoint endpoint = null;
String inputChannelName = MessagingAnnotationUtils.resolveAttribute(annotations, getInputChannelAttribute(), String.class);
if (StringUtils.hasText(inputChannelName)) {
MessageChannel inputChannel;
try {
inputChannel = this.channelResolver.resolveDestination(inputChannelName);
} catch (DestinationResolutionException e) {
if (e.getCause() instanceof NoSuchBeanDefinitionException) {
inputChannel = new DirectChannel();
this.beanFactory.registerSingleton(inputChannelName, inputChannel);
inputChannel = (MessageChannel) this.beanFactory.initializeBean(inputChannel, inputChannelName);
} else {
throw e;
}
}
Assert.notNull(inputChannel, "failed to resolve inputChannel '" + inputChannelName + "'");
endpoint = doCreateEndpoint(handler, inputChannel, annotations);
}
return endpoint;
}
Aggregations