What’s new?

What’s New in 3.2 Since 3.1

本部分涵盖了从版本 3.1 到版本 3.2 所做的更改。有关早期版本中的更改,请参见 Change History

This section covers the changes made from version 3.1 to version 3.2. For changes in earlier version, see Change History.

Kafka Client Version

此版本需要 3.7.0 kafka-clients

This version requires 3.7.0 kafka-clients.

Kafka Streams Interactive Query Support

一个用于访问 Kafka 流交互式查询中使用的可查询存储的新 API KafkaStreamsInteractiveQuerySupport。见 Kafka Streams Interactive Support 了解更多详情。

A new API KafkaStreamsInteractiveQuerySupport for accessing queryable stores used in Kafka Streams interactive queries. See Kafka Streams Interactive Support for more details.

TransactionIdSuffixStrategy

一个新的 TransactionIdSuffixStrategy 接口被用来管理 transactional.id 后缀。在 maxCache 设置大于零时,默认实现 DefaultTransactionIdSuffixStrategy 可以重新使用特定范围内的 transactional.id,否则会通过增加计数器来实时生成后缀。见 Fixed TransactionIdSuffix 了解更多信息。

A new TransactionIdSuffixStrategy interface was introduced to manage transactional.id suffix. The default implementation is DefaultTransactionIdSuffixStrategy when setting maxCache greater than zero can reuse transactional.id within a specific range, otherwise suffixes will be generated on the fly by incrementing a counter. See Fixed TransactionIdSuffix for more information.

Async @KafkaListener Return

@KafkaListener(以及 @KafkaHandler)方法现在能够返回异步返回类型,其中包括 CompletableFuture<?>Mono<?> 和 Kotlin suspend 函数。请参阅 Async Returns 了解更多信息。

@KafkaListener (and @KafkaHandler) methods can now return asynchronous return types include CompletableFuture<?>, Mono<?> and Kotlin suspend functions. See Async Returns for more information.

Routing of messages to custom DLTs based on thrown exceptions

现在可以根据消息处理期间抛出的异常类型将消息重定向到自定义的 DLT。重定向规则通过 RetryableTopic.exceptionBasedDltRoutingRetryTopicConfigurationBuilder.dltRoutingRules 设置。自定义的 DLT 将被自动创建,就像其他重试和死信主题一样。见 Routing of messages to custom DLTs based on thrown exceptions 了解更多信息。

It’s now possible to redirect messages to the custom DLTs based on the type of the exception, which has been thrown during the message processing. Rules for the redirection are set either via the RetryableTopic.exceptionBasedDltRouting or the RetryTopicConfigurationBuilder.dltRoutingRules. Custom DLTs are created automatically as well as other retry and dead-letter topics. See Routing of messages to custom DLTs based on thrown exceptions for more information.

Deprecating ContainerProperties transactionManager property

弃用 ContainerProperties 中的 transactionManager 属性,支持 KafkaAwareTransactionManager,与通用型 PlatformTransactionManager 相比是一个更小范围的类型。见 ContainerPropertiesTransaction Synchronization

Deprecating the transactionManager property in ContainerProperties in favor of KafkaAwareTransactionManager, a narrower type compared to the general PlatformTransactionManager. See ContainerProperties and Transaction Synchronization.

After Rollback Processing

提供了一个新 AfterRollbackProcessor API processBatch。见 After-rollback Processor 了解更多信息。

A new AfterRollbackProcessor API processBatch is provided. See After-rollback Processor for more information.

Change @RetryableTopic SameIntervalTopicReuseStrategy default value

更改 @RetryableTopic 属性 SameIntervalTopicReuseStrategy 的默认值至 SINGLE_TOPIC。见 Single Topic for maxInterval Exponential Delay

Change @RetryableTopic property SameIntervalTopicReuseStrategy default value to SINGLE_TOPIC. See Single Topic for maxInterval Exponential Delay.

Non-blocking retries support class level @KafkaListener

无阻塞重试支持 @"5"。请参阅 @"6"。

Non-blocking retries support @KafkaListener on a Class. See Non-Blocking Retries.

Support process @RetryableTopic on a class in RetryTopicConfigurationProvider.

提供一个新的公开 API 来查找 RetryTopicConfiguration。见 Find RetryTopicConfiguration

Provides a new public API to find RetryTopicConfiguration. See Find RetryTopicConfiguration

RetryTopicConfigurer support process MultiMethodKafkaListenerEndpoint.

RetryTopicConfigurer 支持过程并注册 MultiMethodKafkaListenerEndpointMultiMethodKafkaListenerEndpoint 为属性 defaultMethodmethods 提供 getter/setter。仅严格针对 MethodKafkaListenerEndpoint 类型修改 EndpointCustomizerEndpointHandlerMethod 添加了新的构造函数,用于为提供的 bean 构造一个实例。提供新的类 EndpointHandlerMultiMethod 来处理用于重试端点的多方法。

The RetryTopicConfigurer support process and register MultiMethodKafkaListenerEndpoint. The MultiMethodKafkaListenerEndpoint provides getter/setter for properties defaultMethod and methods. Modify the EndpointCustomizer that strictly for MethodKafkaListenerEndpoint types. The EndpointHandlerMethod add new constructors construct an instance for the provided bean. Provides new class EndpointHandlerMultiMethod to handler multi method for retrying endpoints.

New API method to seek to an offset based on a user provided function

ConsumerCallback 提供了一项新 API 来根据用户自定义函数查找一个偏移,该函数将消耗者中当前的偏移作为参数。见 Seek API Docs 了解更多详情。

ConsumerCallback provides a new API to seek to an offset based on a user-defined function, which takes the current offset in the consumer as an argument. See Seek API Docs for more details.

New constructor in TopicPartitionOffset that accepts a function to compute the offset to seek to

TopicPartitionOffset 有一个新的构造函数,用来生成用于计算要查找的偏移量的用户提供函数。当使用这个构造函数时,框架会用当前消耗者偏移位置的输入参数来调用函数。见 Seek API Docs 了解更多详情。

TopicPartitionOffset has a new constructor that takes a user-provided function to compute the offset to seek to. When this constructor is used, the framework calls the function with the input argument of the current consumer offset position. See Seek API Docs for more details.

Spring Boot application name as default client ID prefix

对于定义了应用程序名称的 Spring Boot 应用程序,这个名称现在用作某些客户端类型的自动生成的客户端 ID 的默认前缀。见 Default client ID prefixes 了解更多详情。

For Spring Boot applications which define an application name, this name is now used as a default prefix for auto-generated client IDs for certain client types. See Default client ID prefixes for more details.