GH-2007 Ensure StreamBridge does not attempt to create Message from Message

Resolves #2007
This commit is contained in:
Oleg Zhurakousky
2020-09-22 15:05:45 +02:00
parent 29fb69a2cd
commit 3364771da5

View File

@@ -145,8 +145,9 @@ public final class StreamBridge implements SmartInitializingSingleton {
boolean skipConversion = producerProperties.isUseNativeEncoding();
Function<Object, Object> functionToInvoke = skipConversion ? v -> MessageBuilder.withPayload(v).build() :
this.functionCatalog.lookup(STREAM_BRIDGE_FUNC_NAME, outputContentType.toString());
Function<Object, Object> functionToInvoke = skipConversion
? v -> v instanceof Message ? v : MessageBuilder.withPayload(v).build()
: this.functionCatalog.lookup(STREAM_BRIDGE_FUNC_NAME, outputContentType.toString());
if (producerProperties != null && producerProperties.isPartitioned()) {
functionToInvoke = new PartitionAwareFunctionWrapper((FunctionInvocationWrapper) functionToInvoke, this.applicationContext, producerProperties);