return;
}
// reply logic
if (getEndpoint().isInOut()) {
MessageChannel reply = null;
// get the output channel from message header
Object returnAddress = siInMessage.getHeaders().getReplyChannel();
if (returnAddress != null) {
if (returnAddress instanceof String) {
reply = context.getApplicationContext().getBean((String)returnAddress, MessageChannel.class);
} else if (returnAddress instanceof MessageChannel) {
reply = (MessageChannel) returnAddress;
}
} else {
reply = outputChannel;
// we want to do in-out so the inputChannel is mandatory (used to receive reply from spring integration)
if (reply == null) {
throw new IllegalArgumentException("OutputChannel has not been configured on " + getEndpoint());
}
}
if (reply == null) {
throw new IllegalArgumentException("Cannot resolve ReplyChannel from message: " + siInMessage);
}
// put the message back the outputChannel if we need
org.springframework.integration.Message<?> siOutMessage =
SpringIntegrationBinding.storeToSpringIntegrationMessage(exchange.getOut());
// send the message to spring integration
log.debug("Sending {} to ReplyChannel: {}", siOutMessage, reply);
reply.send(siOutMessage);
}
}