Search in sources :

Example 1 with BrokerIdNotRegisteredException

use of org.apache.kafka.common.errors.BrokerIdNotRegisteredException in project kafka by apache.

the class ReplicationControlManager method unregisterBroker.

public ControllerResult<Void> unregisterBroker(int brokerId) {
    BrokerRegistration registration = clusterControl.brokerRegistrations().get(brokerId);
    if (registration == null) {
        throw new BrokerIdNotRegisteredException("Broker ID " + brokerId + " is not currently registered");
    }
    List<ApiMessageAndVersion> records = new ArrayList<>();
    handleBrokerUnregistered(brokerId, registration.epoch(), records);
    return ControllerResult.of(records, null);
}
Also used : BrokerIdNotRegisteredException(org.apache.kafka.common.errors.BrokerIdNotRegisteredException) ApiMessageAndVersion(org.apache.kafka.server.common.ApiMessageAndVersion) ArrayList(java.util.ArrayList) BrokerRegistration(org.apache.kafka.metadata.BrokerRegistration)

Aggregations

ArrayList (java.util.ArrayList)1 BrokerIdNotRegisteredException (org.apache.kafka.common.errors.BrokerIdNotRegisteredException)1 BrokerRegistration (org.apache.kafka.metadata.BrokerRegistration)1 ApiMessageAndVersion (org.apache.kafka.server.common.ApiMessageAndVersion)1