exchange.setIn(new SpringIntegrationMessage(siInMessage));
getProcessor().process(exchange);
if (endpoint.isInOut()) {
// get the output channel from message header
Object returnAddress = siInMessage.getHeaders().getReturnAddress();
MessageChannel reply = null;
if (returnAddress != null) {
if (returnAddress instanceof String) {
reply = (MessageChannel)context.getApplicationContext().getBean((String)returnAddress);
} else if (returnAddress instanceof MessageChannel) {
reply = (MessageChannel) returnAddress;
}
} else {
if (outputChannel != null) {
// using the outputChannel
reply = outputChannel;
} else {
if (ObjectHelper.isNullOrBlank(endpoint.getOutputChannel())) {
outputChannel = (MessageChannel) channelRegistry.lookupChannel(endpoint.getOutputChannel());
ObjectHelper.notNull(inputChannel, "The outputChannel with the name [" + endpoint.getOutputChannel() + "]");
reply = outputChannel;
} else {
throw new RuntimeCamelException("Can't find the right outputChannelName");
}
}
}
// put the message back the outputChannel if we need
org.springframework.integration.message.Message siOutMessage =
SpringIntegrationBinding.storeToSpringIntegrationMessage(exchange.getOut());
reply.send(siOutMessage);
}
}