if (replyChannel == null) {
MessageChannel messageReplyChannel = (MessageChannel) message.getHeaders().get(MessageHeaders.REPLY_CHANNEL);
if (messageReplyChannel != null) {
result = messageReplyChannel.send(response);
} else {
throw new MessageDeliveryException(response, "Cannot resolve ReplyChannel from message: " + message);
}
} else {
result = replyChannel.send(response);
}
}