Skip to content

Commit

Permalink
GH-2971 Properly handle Kafka tombstone payload conversion
Browse files Browse the repository at this point in the history
See the corresponding commit in s-c-function
Resolves #2971
  • Loading branch information
olegz committed Jul 17, 2024
1 parent b5eccf6 commit 07e7d81
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@
*/
class FunctionBatchingTests {

@Test
void messageWithKafkaNull() {
TestChannelBinderConfiguration.applicationContextRunner(KafkaNullConfiguration.class)
.withPropertyValues("spring.cloud.stream.function.definition=myFunction").run(context -> {
InputDestination inputDestination = context.getBean(InputDestination.class);
OutputDestination outputDestination = context.getBean(OutputDestination.class);

var message = MessageBuilder.withPayload(KafkaNull.INSTANCE).build();
inputDestination.send(message);

Object kn = outputDestination.receive().getPayload();

assertThat(kn).isInstanceOf(KafkaNull.class);
context.stop();
});
}

@Test
void messageBatchConfigurationWithKafkaNull() {
TestChannelBinderConfiguration.applicationContextRunner(MessageBatchConfiguration.class)
Expand Down Expand Up @@ -300,4 +317,12 @@ public void setName(String name) {

}

@EnableAutoConfiguration
public static class KafkaNullConfiguration {
@Bean
public Function<Message<?>, Message<?>> myFunction() {
return v -> MessageBuilder.withPayload(KafkaNull.INSTANCE).build();
}
}

}

0 comments on commit 07e7d81

Please sign in to comment.