@Override
    public void onMetadataUpdate(
        MetadataDelta delta,
        MetadataImage newImage,
        LoaderManifest manifest
    ) {
        boolean checkBrokerRegistration = false;
        if (delta.featuresDelta() != null) {
            if (delta.metadataVersionChanged().isPresent()) {
                if (log.isTraceEnabled()) {
                    log.trace("Metadata version change is present: {}",
                        delta.metadataVersionChanged());
                }
                checkBrokerRegistration = true;
            }
        }
        if (delta.clusterDelta() != null) {
            if (delta.clusterDelta().changedBrokers().get(id) != null) {
                if (log.isTraceEnabled()) {
                    log.trace("Broker change is present: {}",
                        delta.clusterDelta().changedBrokers().get(id));
                }
                checkBrokerRegistration = true;
            }
        }
        if (checkBrokerRegistration) {
            if (brokerRegistrationNeedsRefresh(newImage.features().metadataVersion(),
                    delta.clusterDelta().broker(id))) {
                refreshRegistrationCallback.run();
            }
        }
    }
Create the tracker.

@param id                            The ID of this broker.
@param refreshRegistrationCallback   Callback to run if we need to refresh the registration.
metadata/src/main/java/org/apache/kafka/image/publisher/BrokerRegistrationTracker.java