Skip to content

Latest commit

 

History

History
93 lines (50 loc) · 3.85 KB

whats-new.adoc

File metadata and controls

93 lines (50 loc) · 3.85 KB

What’s new in 2.2 Since 2.1

Kafka Client Version

This version requires the 2.0.0 kafka-clients or higher.

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).

After rollback processing

A new AfterRollbackProcessor strategy is provided - see [after-rollback] for more information.

ConcurrentKafkaListenerContainerFactory changes

The ConcurrentKafkaListenerContainerFactory can now be used to create/configure any ConcurrentMessageListenerContainer, not just those for @KafkaListener annotations. See [container-factory] for more information.

Listener Container Changes

A new container property missingTopicsFatal has been added.

See [kafka-container] for more information.

A ConsumerStoppedEvent is now emitted when a consumer terminates.

See [thread-safety] for more information.

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

See [batch-listeners] for more information.

The DefaultAfterRollbackProcessor and SeekToCurrentErrorHandler can now recover (skip) records that keep failing, and will do so after 10 failures, by default. They can be configured to publish failed records to a dead-letter topic.

See [after-rollback], [seek-to-current] and [dead-letters] for more information.

@KafkaListener Changes

You can now override the concurrency and autoStartup properties of the listener container factory by setting properties on the annotation.

See [kafka-listener-annotation] for more information.

You can now use @KafkaListener as a meta-annotation on your own annotations.

See [kafka-listener-meta] for more information.

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 [headers] for more information.

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 [testing] for more information.

JsonSerializer/Deserializer Enhancements

You can now provide type mapping information using producer/consumer properties.

New constructors are available on the deserializer to allow overriding the type header information with the supplied target type.

The JsonDeserializer will now remove any type information headers by default.

See [serdes] for more information.

Kafka Streams Changes

The streams configuration bean must now be a simple Properties object instead of a StreamsConfig.

The StreamsBuilderFactoryBean has been moved from package …​core to …​config.

See [kafka-streams] for more information.

Transactional Id

When a transaction is started by the listener container, the transactional.id is now the transactionIdPrefix appended with <group.id>.<topic>.<partition>. This is to allow proper fencing of zombies as described here.