Search in sources :

Example 11 with BrokerRegistration

use of org.apache.kafka.metadata.BrokerRegistration in project kafka by apache.

the class ClusterImage method write.

public void write(Consumer<List<ApiMessageAndVersion>> out) {
    List<ApiMessageAndVersion> batch = new ArrayList<>();
    for (BrokerRegistration broker : brokers.values()) {
        batch.add(broker.toRecord());
    }
    out.accept(batch);
}
Also used : ApiMessageAndVersion(org.apache.kafka.server.common.ApiMessageAndVersion) ArrayList(java.util.ArrayList) BrokerRegistration(org.apache.kafka.metadata.BrokerRegistration)

Example 12 with BrokerRegistration

use of org.apache.kafka.metadata.BrokerRegistration in project kafka by apache.

the class ClusterDelta method replay.

public void replay(RegisterBrokerRecord record) {
    BrokerRegistration broker = BrokerRegistration.fromRecord(record);
    changedBrokers.put(broker.id(), Optional.of(broker));
}
Also used : BrokerRegistration(org.apache.kafka.metadata.BrokerRegistration)

Aggregations

BrokerRegistration (org.apache.kafka.metadata.BrokerRegistration)12 Endpoint (org.apache.kafka.common.Endpoint)6 BrokerEndpoint (org.apache.kafka.common.metadata.RegisterBrokerRecord.BrokerEndpoint)6 ArrayList (java.util.ArrayList)4 ApiMessageAndVersion (org.apache.kafka.server.common.ApiMessageAndVersion)4 RegisterBrokerRecord (org.apache.kafka.common.metadata.RegisterBrokerRecord)2 BrokerFeature (org.apache.kafka.common.metadata.RegisterBrokerRecord.BrokerFeature)2 VersionRange (org.apache.kafka.metadata.VersionRange)2 HashMap (java.util.HashMap)1 Random (java.util.Random)1 BrokerIdNotRegisteredException (org.apache.kafka.common.errors.BrokerIdNotRegisteredException)1 DuplicateBrokerRegistrationException (org.apache.kafka.common.errors.DuplicateBrokerRegistrationException)1 InconsistentClusterIdException (org.apache.kafka.common.errors.InconsistentClusterIdException)1 UnsupportedVersionException (org.apache.kafka.common.errors.UnsupportedVersionException)1 BrokerRegistrationRequestData (org.apache.kafka.common.message.BrokerRegistrationRequestData)1 FenceBrokerRecord (org.apache.kafka.common.metadata.FenceBrokerRecord)1 UnregisterBrokerRecord (org.apache.kafka.common.metadata.UnregisterBrokerRecord)1 LogContext (org.apache.kafka.common.utils.LogContext)1 MockTime (org.apache.kafka.common.utils.MockTime)1 BrokerRegistrationReply (org.apache.kafka.metadata.BrokerRegistrationReply)1