|  | 
| 1 | 1 | = What's new? | 
| 2 | 2 | 
 | 
| 3 |  | -[[what-s-new-in-3-3-since-3-2]] | 
| 4 |  | -== What's New in 3.3 Since 3.2 | 
|  | 3 | +[[whats-new-in-4-0-since-3-3]] | 
|  | 4 | +== What's New in 4.0 Since 3.3 | 
| 5 | 5 | :page-section-summary-toc: 1 | 
| 6 | 6 | 
 | 
| 7 |  | -This section covers the changes made from version 3.2 to version 3.3. | 
| 8 |  | -For changes in earlier version, see xref:appendix/change-history.adoc[Change History]. | 
|  | 7 | +This section covers the changes made from version 3.3 to version 4.0. | 
|  | 8 | +For changes in earlier versions, see xref:appendix/change-history.adoc[Change History]. | 
| 9 | 9 | 
 | 
| 10 |  | -[[x33-dlt-topic-naming]] | 
| 11 |  | -=== DLT Topic Naming Convention | 
|  | 10 | +[[x40-apache-kafka-4-0-upgrade]] | 
|  | 11 | +=== Apache Kafka 4.0 Client Upgrade | 
| 12 | 12 | 
 | 
| 13 |  | -The naming convention for DLT topics has been standardized to use the "-dlt" suffix consistently. This change ensures compatibility and avoids conflicts when transitioning between different retry solutions. Users who wish to retain the ".DLT" suffix behavior need to opt-in explicitly by setting the appropriate DLT name property. | 
|  | 13 | +Spring for Apache Kafka has been upgraded to use Apache Kafka client version `4.0.0`. | 
|  | 14 | +This upgrade brings several important changes: | 
| 14 | 15 | 
 | 
| 15 |  | -[[x33-seek-with-group-id]] | 
| 16 |  | -=== Enhanced Seek Operations for Consumer Groups | 
|  | 16 | +* All ZooKeeper-based functionality has been removed as Kafka 4.0 fully transitions to KRaft mode | 
|  | 17 | +* The ZooKeeper dependency has been removed from the project | 
|  | 18 | +* The embedded Kafka test framework now exclusively uses KRaft mode | 
|  | 19 | +* The `EmbeddedKafkaZKBroker` class has been removed, and all functionality is now handled by `EmbeddedKafkaKraftBroker` | 
| 17 | 20 | 
 | 
| 18 |  | -A new method, `getGroupId()`, has been added to the `ConsumerSeekCallback` interface. | 
| 19 |  | -This method allows for more selective seek operations by targeting only the desired consumer group. | 
| 20 |  | -The `AbstractConsumerSeekAware` can also now register, retrieve, and remove all callbacks for each topic partition in a multi-group listener scenario without missing any. | 
| 21 |  | -See the new APIs (`getSeekCallbacksFor(TopicPartition topicPartition)`, `getTopicsAndCallbacks()`) for more details. | 
| 22 |  | -For more details, see xref:kafka/seek.adoc#seek[Seek API Docs]. | 
|  | 21 | +[[x40-embedded-kafka-test-changes]] | 
|  | 22 | +=== Embedded Kafka Test Framework Changes | 
| 23 | 23 | 
 | 
| 24 |  | -[[x33-new-option-ignore-empty-batch]] | 
| 25 |  | -=== Configurable Handling of Empty Batches in Kafka Listener with RecordFilterStrategy | 
|  | 24 | +The test infrastructure has been significantly updated: | 
| 26 | 25 | 
 | 
| 27 |  | -`RecordFilterStrategy` now supports ignoring empty batches that result from filtering. | 
| 28 |  | -This can be configured through overriding default method `ignoreEmptyBatch()`, which defaults to false, ensuring `KafkaListener` is invoked even if all `ConsumerRecords` are filtered out. | 
| 29 |  | -For more details, see xref:kafka/receiving-messages/filtering.adoc[Message receive filtering Docs]. | 
|  | 26 | +* The `EmbeddedKafkaRule` JUnit 4 rule has been removed | 
|  | 27 | +* The `@EmbeddedKafka` annotation has been simplified with the removal of ZooKeeper-related properties: | 
|  | 28 | +* The `kraft` property has been removed as KRaft mode is now the only option | 
|  | 29 | +* ZooKeeper-specific properties like `zookeeperPort`, `zkConnectionTimeout`, and `zkSessionTimeout` have been removed | 
|  | 30 | +* KafkaClusterTestKit imports now use new packages for KRaft mode | 
|  | 31 | +* Some tests have been updated to address limitations with static port assignments in KRaft mode | 
|  | 32 | +* Adjustments have been made to replication factors in tests to accommodate KRaft requirements | 
| 30 | 33 | 
 | 
|  | 34 | +[[x40-consumer-records-constructor-changes]] | 
|  | 35 | +=== ConsumerRecords Constructor Changes | 
| 31 | 36 | 
 | 
| 32 |  | -[[x33-concurrent-container-stopped-event]] | 
| 33 |  | -=== ConcurrentContainerStoppedEvent | 
|  | 37 | +The `ConsumerRecords` constructor now requires an additional `Map` parameter, which has been addressed throughout the framework. | 
|  | 38 | +Applications that directly use this constructor will need to update their code. | 
| 34 | 39 | 
 | 
| 35 |  | -The `ConcurentContainerMessageListenerContainer` emits now a `ConcurrentContainerStoppedEvent` when all of its child containers are stopped. | 
| 36 |  | -For more details, see xref:kafka/events.adoc[Application Events] and `ConcurrentContainerStoppedEvent` Javadocs. | 
|  | 40 | +[[x40-producer-interface-updates]] | 
|  | 41 | +=== Producer Interface Updates | 
| 37 | 42 | 
 | 
| 38 |  | -[[x33-original-record-key-in-reply]] | 
| 39 |  | -=== Original Record Key in Reply | 
|  | 43 | +New methods from the Kafka Producer interface have been implemented: | 
| 40 | 44 | 
 | 
| 41 |  | -When using `ReplyingKafkaTemplate`, if the original record from the request contains a key, then that same key will be part of the reply as well. | 
| 42 |  | -For more details, see xref:kafka/sending-messages.adoc[Sending Messages] section of the reference docs. | 
|  | 45 | +* `registerMetricForSubscription` | 
|  | 46 | +* `unregisterMetricFromSubscription` | 
| 43 | 47 | 
 | 
| 44 |  | -[[x33-customize-logging-in-DeadLetterPublishingRecovererFactory]] | 
| 45 |  | -=== Customizing Logging in DeadLetterPublishingRecovererFactory | 
|  | 48 | +[[x40-removed-deprecated-functionality]] | 
|  | 49 | +=== Removed Deprecated Functionality | 
| 46 | 50 | 
 | 
| 47 |  | -When using `DeadLetterPublishingRecovererFactory`, the user applications can override the `maybeLogListenerException` method to customize the logging behavior. | 
|  | 51 | +Several deprecated items have been removed: | 
| 48 | 52 | 
 | 
| 49 |  | -[[x33-customize-admin-client-in-KafkaAdmin]] | 
| 50 |  | -=== Customize Admin client in KafkaAdmin | 
|  | 53 | +* The deprecated `partitioner` classes have been removed from runtime hints | 
|  | 54 | +* The deprecated `sendOffsetsToTransaction` method that used `String consumerGroupId` has been removed | 
| 51 | 55 | 
 | 
| 52 |  | -When extending `KafkaAdmin`, user applications may override the `createAdmin` method to customize Admin client creation. | 
|  | 56 | +[[x40-kafka-streams-updates]] | 
|  | 57 | +=== Kafka Streams API Changes | 
| 53 | 58 | 
 | 
| 54 |  | -[[x33-customize-kafka-streams-implementation]] | 
| 55 |  | -=== Customizing The Implementation of Kafka Streams | 
|  | 59 | +* `KafkaStreamBrancher` has been updated to use the new `split()` and `branch()` methods instead of the deprecated `branch()` method | 
|  | 60 | +* The `DeserializationExceptionHandler` has been updated to use the new `ErrorHandlerContext` | 
| 56 | 61 | 
 | 
| 57 |  | -When using `KafkaStreamsCustomizer` it is now possible to return a custom implementation of the `KafkaStreams` object by overriding the `initKafkaStreams` method. | 
|  | 62 | +[[x40-internal-api-updates]] | 
|  | 63 | +=== Internal API Updates related to Apache Kafka 4.0.0 | 
| 58 | 64 | 
 | 
| 59 |  | -[[x33-kafka-headers-for-batch-listeners]] | 
| 60 |  | -=== KafkaHeaders.DELIVERY_ATTEMPT for batch listeners | 
| 61 |  | - | 
| 62 |  | -When using a `BatchListener`, the `ConsumerRecord` can have the `KafkaHeaders.DELIVERY_ATTMPT` header in its headers fields. | 
| 63 |  | -If the `DeliveryAttemptAwareRetryListener` is set to error handler as retry listener, each `ConsumerRecord` has delivery attempt header. | 
| 64 |  | -For more details, see xref:kafka/annotation-error-handling.adoc#delivery-attempts-header-for-batch-listener[Kafka Headers for Batch Listener]. | 
| 65 |  | - | 
| 66 |  | -[[x33-task-scheduler-for-kafka-metrics]] | 
| 67 |  | -=== Kafka Metrics Listeners and `TaskScheduler` | 
| 68 |  | - | 
| 69 |  | -The `MicrometerProducerListener`, `MicrometerConsumerListener` and `KafkaStreamsMicrometerListener` can now be configured with a `TaskScheduler`. | 
| 70 |  | -See `KafkaMetricsSupport` JavaDocs and xref:kafka/micrometer.adoc[Micrometer Support] for more information. | 
|  | 65 | +* The `BrokerAddress` class now uses `org.apache.kafka.server.network.BrokerEndPoint` instead of the deprecated `kafka.cluster.BrokerEndPoint` | 
|  | 66 | +* The `GlobalEmbeddedKafkaTestExecutionListener` has been updated to work solely with KRaft mode | 
0 commit comments