For the latest stable version, please use Spring for Apache Kafka 3.3.0!spring-doc.cn

What’s new?

What’s New in 3.1 Since 3.0

This section covers the changes made from version 3.0 to version 3.1. For changes in earlier version, see Change History.spring-doc.cn

Kafka Client Version

This version requires the 3.6.0 kafka-clients.spring-doc.cn

EmbeddedKafkaBroker

An additional implementation is now provided to use Kraft instead of Zookeeper. See Embedded Kafka Broker for more information.spring-doc.cn

JsonDeserializer

When a deserialization exception occurs, the SerializationException message no longer contains the data with the form Can’t deserialize data [[123, 34, 98, 97, 122, …​; an array of numerical values for each data byte is not useful and can be verbose for large data. When used with an ErrorHandlingDeserializer, the DeserializationException sent to the error handler contains the data property which contains the raw data that could not be deserialized. When not used with an ErrorHandlingDeserializer, the KafkaConsumer will continually emit exceptions for the same record showing the topic/partition/offset and the cause thrown by Jackson.spring-doc.cn

ContainerPostProcessor

Post processing can be applied on a listener container by specifying the bean name of a ContainerPostProcessor on the @KafkaListener annotation. This occurs after the container has been created and after any configured ContainerCustomizer configured on the container factory. See Container Factory for more information.spring-doc.cn

ErrorHandlingDeserializer

You can now add a Validator to this deserializer; if the delegate Deserializer successfully deserializes the object, but that object fails validation, an exception is thrown similar to a deserialization exception occurring. This allows the original raw data to be passed to the error handler. See Using ErrorHandlingDeserializer for more information.spring-doc.cn

Retryable Topics

Change suffix -retry-5000 to -retry when @RetryableTopic(backoff = @Backoff(delay = 5000), attempts = "2", fixedDelayTopicStrategy = FixedDelayStrategy.SINGLE_TOPIC). If you want to keep suffix -retry-5000, use @RetryableTopic(backoff = @Backoff(delay = 5000), attempts = "2"). See Topic Naming for more information.spring-doc.cn

Listener Container Changes

When manually assigning partitions, with a null consumer group.id, the AckMode is now automatically coerced to MANUAL. See Manually Assigning All Partitions for more information.spring-doc.cn