https://github.com/apache/kafka/pull/18977

czw., 20 lut 2025 o 07:48 Paweł Szymczyk <pawel.szymczy...@gmail.com>
napisał(a):

> Sure, I would love to continue working on this task and provide an
> interface, I see that someone else has been assigned to Jira recently,
> please let him know that I like to handle it on my own 🙂
>
>
> Dnia 20 lutego 2025 03:51:02 CET, "Matthias J. Sax" <mj...@apache.org>
> napisał/a:
>
>> Thanks for reaching out. This is actually very good feedback.
>>
>> In general, it seems that `ConsumerGroupMetadata` should be an interface, 
>> not a class, making it impossible for users to create an instance.
>>
>> Of course, we cannot do anything for older releases, and it seems the 
>> JavaDocs do explain it correctly...
>>
>> But I did file https://issues.apache.org/jira/browse/KAFKA-18836 -- feel 
>> free to pick it up if you have interest to contribute a fix for Apache Kafka 
>> 4.1 release.
>>
>>
>> -Matthias
>>
>>
>> On 2/19/25 9:17 AM, Paweł Szymczyk wrote:
>>
>>> Hello!
>>>
>>> Recently, I had an opportunity to work with legacy code that was using an
>>> old version of the Kafka native producer transactional API. Our goal was to
>>> upgrade the code to the newest version and benefit from the upgraded
>>> transactional API protocol. Initially, we found code that was highlighted
>>> as deprecated (
>>> https://kafka.apache.org/25/javadoc/org/apache/kafka/clients/producer/Producer.html#sendOffsetsToTransaction-java.util.Map-java.lang.String-
>>> ):
>>>
>>> kafkaProducer.sendOffsetsToTransaction(Map.of(new
>>>> TopicPartition(record.topic(), record.partition()), new
>>>> OffsetAndMetadata(record.offset())), groupId);
>>>>
>>>>
>>> Our first approach was to use the non-deprecated API:
>>>
>>> kafkaProducer.sendOffsetsToTransaction(Map.of(new
>>>
>>>> TopicPartition(record.topic(), record.partition()), new
>>>> OffsetAndMetadata(record.offset())), new ConsumerGroupMetadata(groupId));
>>>>
>>>
>>>
>>> A few days later, after an extensive testing session, we finally read the
>>> new sendOffsetsToTransaction method javadoc and discovered that we needed
>>> to retrieve metadata from the Kafka Consumer.
>>>
>>>  From our perspective, this upgrade process was more complicated than
>>> expected and requires broad knowledge of the transactional protocol
>>> upgrade. Are there any contradictions in making the public
>>> ConsumerGroupMetadata(String
>>> groupId) constructor deprecated too? It would have given us a clear hint
>>> that we were still doing something wrong from the start.
>>>
>>>
>> Paweł Szymczyk
>


-- 
Pozdrawiam
Paweł Szymczyk

Reply via email to