Skip to content

Commit 0af8e9f

Browse files
committed
review fix
After kafka client 2.4 producer uses sticky partition, its randomly chose partition and topic default partitions is 2, configure that @embeddedkafka to provide just one partition per topic. * javadoc in `AsyncRepliesAware` * fix test in EnableKafkaKotlinCoroutinesTests * polish adoc
1 parent bf8bb23 commit 0af8e9f

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

spring-kafka-docs/src/main/antora/modules/ROOT/pages/kafka/receiving-messages/async-returns.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
= Asynchronous `@KafkaListener` Return Types
33

44
`@KafkaListener` (and `@KafkaHandler`) methods can be specified with asynchronous return types, letting the reply be sent asynchronously.
5-
return types include `CompletableFuture<?>`, `Mono<?>` and Kotlin `suspend` functions
5+
return types include `CompletableFuture<?>`, `Mono<?>` and Kotlin `suspend` functions.
66

77
[source, java]
88
----

spring-kafka-docs/src/main/antora/modules/ROOT/pages/whats-new.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ See xref:kafka/transactions.adoc#transaction-id-suffix-fixed[Fixed TransactionId
1717
[[x32-async-return]]
1818
=== Async @KafkaListener Return
1919

20-
`@KafkaListener` (and `@KafkaHandler`) methods can now return asynchronous return types `CompletableFuture<?>` and `Mono<?>`.
20+
`@KafkaListener` (and `@KafkaHandler`) methods can now return asynchronous return types include `CompletableFuture<?>`, `Mono<?>` and Kotlin `suspend` functions.
2121
See xref:kafka/receiving-messages/async-returns.adoc[Async Returns] for more information.

spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/AsyncRepliesAware.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 the original author or authors.
2+
* Copyright 2023-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,15 +17,16 @@
1717
package org.springframework.kafka.listener.adapter;
1818

1919
/**
20-
* Auto-detect {@link HandlerAdapter} return type.
20+
* Message handler adapter implementing this interface can detect {@link HandlerAdapter} async return types.
2121
*
2222
* @author Wang zhiyang
23+
*
2324
* @since 3.2
2425
*/
2526
public interface AsyncRepliesAware {
2627

2728
/**
28-
* Return true if this listener is request/reply and the replies are async.
29+
* Return true if the {@link HandlerAdapter} return type is async.
2930
* @return true for async replies.
3031
* @since 3.2
3132
*/

spring-kafka/src/main/java/org/springframework/kafka/listener/adapter/ContinuationHandlerMethodArgumentResolver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
* but for regular {@link HandlerMethodArgumentResolver} contract.
3131
*
3232
* @author Wang Zhiyang
33+
*
3334
* @since 3.2
35+
*
3436
* @see org.springframework.messaging.handler.annotation.reactive.ContinuationHandlerMethodArgumentResolver
3537
*/
3638
public class ContinuationHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {

spring-kafka/src/test/kotlin/org/springframework/kafka/listener/EnableKafkaKotlinCoroutinesTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ import java.util.concurrent.TimeUnit
5656
@SpringJUnitConfig
5757
@DirtiesContext
5858
@EmbeddedKafka(topics = ["kotlinAsyncTestTopic1", "kotlinAsyncTestTopic2",
59-
"kotlinAsyncBatchTestTopic1", "kotlinAsyncBatchTestTopic2", "kotlinReplyTopic1"])
59+
"kotlinAsyncBatchTestTopic1", "kotlinAsyncBatchTestTopic2", "kotlinReplyTopic1"], partitions = 1)
6060
class EnableKafkaKotlinCoroutinesTests {
6161

6262
@Autowired

0 commit comments

Comments
 (0)