GH-2113 Add safety check and create Message if necessary

. . . when sending data using template and the data is not a Message

Resolves #2113
This commit is contained in:
Oleg Zhurakousky
2021-03-19 15:08:04 +01:00
parent 5cd14e4a8d
commit 5d0ffe7b80

View File

@@ -586,6 +586,9 @@ public class FunctionConfiguration {
outputChannel.send(((Message<?>) result));
}
else if (StringUtils.hasText(outputChannelName)) {
if (!(result instanceof Message)) {
result = MessageBuilder.withPayload(result).copyHeadersIfAbsent(requestMessage.getHeaders()).build();
}
template.send(outputChannelName, (Message<?>) result);
}
}