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.

Kafka Client Version

This version requires the 3.6.0 kafka-clients.

EmbeddedKafkaBroker

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

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.

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.

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.

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.

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.