StreamBridge and KafkaNull

When sending KafkaNull over StreamBridge, we need to repackage the
potential null result back into KafkaNull.
This commit is contained in:
Soby Chacko
2023-01-09 20:02:45 -05:00
parent 2ff6938bc6
commit b1ebc457fd

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020-2021 the original author or authors.
* Copyright 2020-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -172,6 +172,11 @@ public final class StreamBridge implements StreamOperations, SmartInitializingSi
resultMessage = (Message<byte[]>) functionToInvoke.apply(messageToSend);
}
if (resultMessage == null
&& ((Message) messageToSend).getPayload().getClass().getName().equals("org.springframework.kafka.support.KafkaNull")) {
resultMessage = messageToSend;
}
resultMessage = (Message<?>) this.functionInvocationHelper.postProcessResult(resultMessage, null);
return messageChannel.send(resultMessage);