Upgrade kafka-clients to 4.2.0 and fix deprecated API usage#507
Open
pjfanning wants to merge 3 commits intoapache:mainfrom
Open
Upgrade kafka-clients to 4.2.0 and fix deprecated API usage#507pjfanning wants to merge 3 commits intoapache:mainfrom
pjfanning wants to merge 3 commits intoapache:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades
kafka-clientsfrom 4.1.2 to 4.2.0 and fixes all compilation issues caused by newly deprecated/removed APIs.Changes
Version bump
kafkaVersion = "4.1.2"→"4.2.0"inproject/Versions.scalaConsumerGroupMetadata constructors (deprecated with
forRemoval=truein 4.2.0)Instead of creating
new ConsumerGroupMetadata(groupId)inTransactionalProducerStage, the actualConsumerGroupMetadatais now threaded from the Kafka consumer through the message pipeline:groupMetadata: Option[ConsumerGroupMetadata]toKafkaConsumerActor.Internal.MessagesKafkaConsumerActorincludesconsumer.groupMetadata()when sending non-empty messagesonGroupMetadatahook toBaseSingleSourceLogicandSubSourceLogicconsumerGroupMetadata: ConsumerGroupMetadataabstract method toTransactionalMessageBuilderBaseTransactionalSourceLogicandTransactionalSubSourceStageLogictrack the current group metadataconsumerGroupMetadatafield toPartitionOffsetCommittedMarkerTransactionalProducerStage.commitTransactionnow usesbatch.groupMetadatadirectlyThis is a proper fix (not just suppression): transactions now use the actual consumer's group metadata (including generation ID and member ID), which provides proper zombie-fencing semantics for EOS.
consumer.close(Duration)(deprecated)Replaced with
consumer.close(CloseOptions.timeout(duration))inKafkaConsumerActor.postStop; removed now-unneeded@nowarnannotation.ConsumerGroupDescription.state()/ConsumerGroupState(deprecated since 4.0,forRemoval=true)Replaced with
groupState()/GroupState.STABLEin bothKafkaSpec.scalaandBaseKafkaTest.java.Benchmark
Replaced
new ConsumerGroupMetadata(fixture.groupId)withconsumer.groupMetadata()(the fixture has a realKafkaConsumerreference).Test infrastructure
ConsumerDummy.groupMetadata()now returns a non-throwing stub value. A@nowarn("msg=deprecated")annotation is used here since it's a mock consumer without a real Kafka connection, making the deprecated constructor the only option in this context.