DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
Compatibility, Deprecation, and Migration Plan
- What impact (if any) will there be on existing users?
- If we are changing behavior how will we phase out the older behavior?
- If we need special migration tools, describe them here.
- When will we remove the existing behavior?
Test Plan
Describe in few sentences how the KIP will be tested. We are mostly interested in system tests (since unit-tests are specific to implementation details). How will we know that the implementation works as expected? How will we know nothing broke?
Rejected Alternatives
...
- Change is impacting all users using any available constructor of ConsumerGroupMetadata class.
- For Kafka 4.1, we need to keep the class ConsumerGroupMetadata as-is, to maintain backward compatibility. We should only deprecate both constructors, and update the JavaDocs saying, that this class will become an interface in the future.
- For Kafka 5.0, we do the actual code change from class to interface.
Test Plan
Automated tests which are part of CI will cover necessary tests.
Rejected Alternatives
We can make all constructors in ConsumerGroupMetadata private and provide new static factory method which will be getting instance of group metadata from Kafka Consumer.
| Code Block | ||||
|---|---|---|---|---|
| ||||
public class ConsumerGroupMetadata {
private final String groupId;
private final int generationId;
private final String memberId;
private final Optional<String> groupInstanceId;
public ConsumerGroupMetadata newInstance(KafkaConsumer<?,?> kafkaConsumer) {
return kafkaConsumer.groupMetadata();
}
private ConsumerGroupMetadata(String groupId,
int generationId,
String memberId,
Optional<String> groupInstanceId) {
this.groupId = Objects.requireNonNull(groupId, "group.id can't be null");
this.generationId = generationId;
this.memberId = Objects.requireNonNull(memberId, "member.id can't be null");
this.groupInstanceId = Objects.requireNonNull(groupInstanceId, "group.instance.id can't be null");
}
private ConsumerGroupMetadata(String groupId) {
this(groupId,
JoinGroupRequest.UNKNOWN_GENERATION_ID,
JoinGroupRequest.UNKNOWN_MEMBER_ID,
Optional.empty());
}
public String groupId() {
return groupId;
}
public int generationId() {
return generationId;
}
public String memberId() {
return memberId;
}
public Optional<String> groupInstanceId() {
return groupInstanceId;
}
@Override
public String toString() {
return String.format("GroupMetadata(groupId = %s, generationId = %d, memberId = %s, groupInstanceId = %s)",
groupId,
generationId,
memberId,
groupInstanceId.orElse(""));
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final ConsumerGroupMetadata that = (ConsumerGroupMetadata) o;
return generationId == that.generationId &&
Objects.equals(groupId, that.groupId) &&
Objects.equals(memberId, that.memberId) &&
Objects.equals(groupInstanceId, that.groupInstanceId);
}
@Override
public int hashCode() {
return Objects.hash(groupId, generationId, memberId, groupInstanceId);
}
}
|