use of org.apache.kafka.common.metadata.RegisterBrokerRecord in project kafka by apache.
the class BrokerRegistration method toRecord.
public ApiMessageAndVersion toRecord() {
RegisterBrokerRecord registrationRecord = new RegisterBrokerRecord().setBrokerId(id).setRack(rack.orElse(null)).setBrokerEpoch(epoch).setIncarnationId(incarnationId).setFenced(fenced);
for (Entry<String, Endpoint> entry : listeners.entrySet()) {
Endpoint endpoint = entry.getValue();
registrationRecord.endPoints().add(new BrokerEndpoint().setName(entry.getKey()).setHost(endpoint.host()).setPort(endpoint.port()).setSecurityProtocol(endpoint.securityProtocol().id));
}
for (Entry<String, VersionRange> entry : supportedFeatures.entrySet()) {
registrationRecord.features().add(new BrokerFeature().setName(entry.getKey()).setMinSupportedVersion(entry.getValue().min()).setMaxSupportedVersion(entry.getValue().max()));
}
return new ApiMessageAndVersion(registrationRecord, REGISTER_BROKER_RECORD.highestSupportedVersion());
}
Aggregations