2. What’s new?

2.1 What’s new in 2.2 Since 2.1

2.1.1 Kafka Client Version

This version requires the 1.1.0 kafka-clients or higher.

2.1.2 Class/Package Changes

The class ContainerProperties has been moved from org.springframework.kafka.listener.config to org.springframework.kafka.listener.

The enum AckMode has been moved from AbstractMessageListenerContainer to ContainerProperties.

setBatchErrorHandler() and setErrorHandler() methods have been moved from ContainerProperties to AbstractMessageListenerContainer (and AbstractKafkaListenerContainerFactory).

2.1.3 After rollback processing

A new AfterRollbackProcessor strategy is provided - see the section called “After Rollback Processor” for more information.

2.1.4 ConcurrentKafkaListenerContainerFactory changes

The ConcurrentKafkaListenerContainerFactory can now be used to create/configure any ConcurrentMessageListenerContainer, not just those for @KafkaListener annotations. See the section called “Container factory” for more information.

2.1.5 Listener Container Changes

A new container property missingTopicsFatal has been added.

See the section called “KafkaMessageListenerContainer” for more information.

Batch listeners can optionally receive the complete ConsumerRecords<?, ?> object instead of a List<ConsumerRecord<?, ?>.

See the section called “Batch listeners” for more information.

2.1.6 Header Mapping Changes

Headers of type MimeType and MediaType are now mapped as simple strings in the RecordHeader value. Previously, they were mapped as JSON and only MimeType was decoded, MediaType could not be decoded. They are now simple strings for interoperability.

Also, the DefaultKafkaHeaderMapper has a new method addToStringClasses allowing the specification of types that should be mapped using toString() instead of JSON.

See Section 4.1.6, “Message Headers” for more information.

2.1.7 Embedded Kafka Changes

The KafkaEmbedded class and its KafkaRule interface have need deprecated in favor of the EmbeddedKafkaBroker and its JUnit 4 EmbeddedKafkaRule wrapper. The @EmbeddedKafka annotation now populates an EmbeddedKafkaBroker bean instead of the deprecated KafkaEmbedded. This allows the use of @EmbeddedKafka in JUnit 5 tests.

See Section 4.3, “Testing Applications” for more information.