Is there any way to determine the broker version in the kafka-clients?

I need to determine whether I can use the new  sendOffsetsToTransaction
with ConsumerGroupMetadata or use the old one.

If I use the new API with a 2.4.1 broker, I get

UpsupportedVersionException: Attempted to write a non-default generationId
at version 2

Alternatively, couldn't the client simply extract the groupId from the
ConsumerGroupMetadata and use the old struct if the broker is too old?

I'd rather not have a user property in my framework to tell us which API to
use.

Thanks in advance.

Reply via email to