public class ConfluentLicenseValidator extends java.lang.Object implements org.apache.kafka.server.license.LicenseValidator, java.util.function.Consumer<LicenseChanged>
InvalidLicenseException
if the license is
invalid or has expired. The component using the license (e.g. broker) fails to start as
a result without a valid or free license. Thereafter, the component may continue to function
with proprietary features enabled even if license expires. In this case, an error is logged
periodically.
License is stored in a Kafka topic in the MDS cluster if MDS is enabled. Otherwise it is stored
in the Kafka cluster associated with the component.
Since LicenseManager is used by several components, broker-specific startup sequence is
managed by ConfluentLicenseValidator. If a valid license is configured, license store is
started asynchronously. License is registered if/when license store start up completes.
Broker starts up successfully if a valid license is configured in server.properties even
if the license topic cannot be created or is unavailable. If a valid license is not configured,
license validator blocks on the license store during start up and broker start up fails if
the license topic is unavailable within the create timeout.Modifier and Type | Class and Description |
---|---|
static class |
ConfluentLicenseValidator.LicenseStatus |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
METRIC_GROUP |
static java.lang.String |
METRIC_NAME |
Constructor and Description |
---|
ConfluentLicenseValidator() |
Modifier and Type | Method and Description |
---|---|
void |
accept(LicenseChanged licenseChanged) |
void |
close() |
void |
configure(java.util.Map<java.lang.String,?> configs) |
protected LicenseManager |
createLicenseManager(LicenseConfig licenseConfig) |
protected io.confluent.license.validator.ConfluentLicenseValidator.KafkaLicenseStore |
createLicenseStore(LicenseConfig licenseConfig) |
boolean |
enabled() |
boolean |
isLicenseValid() |
protected void |
registerMetric(java.lang.String metricGroup) |
protected void |
schedulePeriodicValidation() |
void |
start(java.lang.String componentId) |
protected void |
updateExpiredStatus(ConfluentLicenseValidator.LicenseStatus status,
java.util.Date expirationDate) |
protected void |
updateLicenseStatus(ConfluentLicenseValidator.LicenseStatus status) |
public static final java.lang.String METRIC_GROUP
public static final java.lang.String METRIC_NAME
public void configure(java.util.Map<java.lang.String,?> configs)
configure
in interface org.apache.kafka.common.Configurable
public final boolean enabled()
enabled
in interface org.apache.kafka.server.license.LicenseValidator
public void start(java.lang.String componentId)
start
in interface org.apache.kafka.server.license.LicenseValidator
public boolean isLicenseValid()
isLicenseValid
in interface org.apache.kafka.server.license.LicenseValidator
public void accept(LicenseChanged licenseChanged)
accept
in interface java.util.function.Consumer<LicenseChanged>
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
protected io.confluent.license.validator.ConfluentLicenseValidator.KafkaLicenseStore createLicenseStore(LicenseConfig licenseConfig)
protected LicenseManager createLicenseManager(LicenseConfig licenseConfig)
protected void updateExpiredStatus(ConfluentLicenseValidator.LicenseStatus status, java.util.Date expirationDate)
protected void updateLicenseStatus(ConfluentLicenseValidator.LicenseStatus status)
protected void registerMetric(java.lang.String metricGroup)
protected void schedulePeriodicValidation()