Class LicenseStore
java.lang.Object
io.confluent.license.LicenseStore
- All Implemented Interfaces:
ConfluentLicenseStore
IMPORTANT: This class should not use Kafka APIs newer than AK 0.11.0/CP 3.3.0.
All of our proprietary connectors are dependent upon the LicenseManager framework
and they all include this dependency in their plugin directory. So, when the connectors are
installed into any CP version, the connector's LicenseManager uses the AK APIs provided by the
Connect installation to create the license topic if necessary. Connectors may be installed into
CP 3.3.0 or newer when `AdminClient.createTopics(...)` was added. We should maintain
compatibility for the LicenseManager for all these versions by using only older APIs that are
available from 3.3.0.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLicenseStore(io.confluent.command.record.Command.CommandKey commandKey, String topic, ConcurrentHashMap<io.confluent.command.record.Command.CommandKey, String> latestLicenses, LicenseKafkaBasedLog<io.confluent.command.record.Command.CommandKey, io.confluent.command.record.Command.CommandMessage> licenseLog, org.apache.kafka.common.utils.Time time) LicenseStore(String topic, Map<String, Object> producerConfig, Map<String, Object> consumerConfig, Map<String, Object> topicConfig) LicenseStore(String topic, Map<String, Object> producerConfig, Map<String, Object> consumerConfig, Map<String, Object> topicConfig, Duration topicCreateTimeout, Duration retryBackoffMinMs, Duration retryBackoffMaxMs, org.apache.kafka.common.utils.Time time) LicenseStore(String topic, Map<String, Object> producerConfig, Map<String, Object> consumerConfig, Map<String, Object> topicConfig, Duration topicCreateTimeout, Duration retryBackoffMinMs, Duration retryBackoffMaxMs, org.apache.kafka.common.utils.Time time, List<io.confluent.command.record.Command.CommandKey> commandKeys) LicenseStore(String topic, Map<String, Object> producerConfig, Map<String, Object> consumerConfig, Map<String, Object> topicConfig, List<io.confluent.command.record.Command.CommandKey> commandKeys) LicenseStore(List<io.confluent.command.record.Command.CommandKey> commandKeys, String topic, ConcurrentHashMap<io.confluent.command.record.Command.CommandKey, String> latestLicenses, LicenseKafkaBasedLog<io.confluent.command.record.Command.CommandKey, io.confluent.command.record.Command.CommandMessage> licenseLog, org.apache.kafka.common.utils.Time time) -
Method Summary
Modifier and TypeMethodDescriptionReturns the current in-memory license state without any topic I/O.Reads the license storeLicenseStoreand returns the latest licenses perLicense.DeploymentScope.booleanWhether this store supports event-based license propagation.Returns a single license only whenLicenseStoreis configured with exactly oneCommand.CommandKey.voidregisterLicense(License.DeploymentScope deploymentScope, String license) Registers a license JWT for the givenLicense.DeploymentScope.voidregisterLicense(String license) Supports single-licenseLicenseStoreonly.voidregisterLicense(String license, org.apache.kafka.clients.producer.Callback callback) Supports single-licenseLicenseStoreonly.voidsetOnDataChangeListener(Runnable listener) Set a listener that is called when new license data arrives in the store.voidstart()voidstop()topic()LicenseStore falls back to_confluent-commandtopic if the topic given in the constructor doesn't exist, so this method provides the actual topic used by the license store.
-
Field Details
-
REPLICATION_FACTOR_CONFIG
- See Also:
-
MIN_INSYNC_REPLICAS_CONFIG
- See Also:
-
READ_TO_END_TIMEOUT_MS
public static final long READ_TO_END_TIMEOUT_MS- See Also:
-
-
Constructor Details
-
LicenseStore
-
LicenseStore
-
LicenseStore
-
LicenseStore
public LicenseStore(String topic, Map<String, Object> producerConfig, Map<String, Object> consumerConfig, Map<String, Object> topicConfig, Duration topicCreateTimeout, Duration retryBackoffMinMs, Duration retryBackoffMaxMs, org.apache.kafka.common.utils.Time time, List<io.confluent.command.record.Command.CommandKey> commandKeys) -
LicenseStore
public LicenseStore(List<io.confluent.command.record.Command.CommandKey> commandKeys, String topic, ConcurrentHashMap<io.confluent.command.record.Command.CommandKey, String> latestLicenses, LicenseKafkaBasedLog<io.confluent.command.record.Command.CommandKey, io.confluent.command.record.Command.CommandMessage> licenseLog, org.apache.kafka.common.utils.Time time) -
LicenseStore
public LicenseStore(io.confluent.command.record.Command.CommandKey commandKey, String topic, ConcurrentHashMap<io.confluent.command.record.Command.CommandKey, String> latestLicenses, LicenseKafkaBasedLog<io.confluent.command.record.Command.CommandKey, io.confluent.command.record.Command.CommandMessage> licenseLog, org.apache.kafka.common.utils.Time time)
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceConfluentLicenseStore
-
stop
public void stop()- Specified by:
stopin interfaceConfluentLicenseStore
-
licenseScan
Returns a single license only whenLicenseStoreis configured with exactly oneCommand.CommandKey. When multiple license types are supported, this method returns null. UsegetLatestLicenses()to retrieve all licenses byLicense.DeploymentScope. For multi-license stores, usegetLatestLicenses()instead.- Specified by:
licenseScanin interfaceConfluentLicenseStore
-
getLatestLicenses
Reads the license storeLicenseStoreand returns the latest licenses perLicense.DeploymentScope. Only keys inRECORDS_KEY_ID_MAPPINGare included; others are ignored.- Specified by:
getLatestLicensesin interfaceConfluentLicenseStore- Returns:
- map of scope to latest license JWT (possibly empty)
- Throws:
IllegalStateException- if reading the log fails or times out
-
registerLicense
Supports single-licenseLicenseStoreonly. For multi-license configurations useregisterLicense(DeploymentScope, String). UseregisterLicense(DeploymentScope, String)for multi-license stores.- Specified by:
registerLicensein interfaceConfluentLicenseStore
-
registerLicense
Supports single-licenseLicenseStoreonly. UseregisterLicense(DeploymentScope, String)for multi-license configurations. -
registerLicense
Registers a license JWT for the givenLicense.DeploymentScope. Only scopes present inLICENSE_SCOPE_TO_KEY_MAPPINGare supported.- Specified by:
registerLicensein interfaceConfluentLicenseStore- Parameters:
deploymentScope- target scope (e.g. CP, CP_FOR_CC)license- JWT to write
-
isEventBasedPropagationSupported
public boolean isEventBasedPropagationSupported()Description copied from interface:ConfluentLicenseStoreWhether this store supports event-based license propagation. When true, the store can notify listeners immediately when new license records arrive, instead of requiring periodic polling.- Specified by:
isEventBasedPropagationSupportedin interfaceConfluentLicenseStore- Returns:
- true if event-based propagation is supported
-
setOnDataChangeListener
Description copied from interface:ConfluentLicenseStoreSet a listener that is called when new license data arrives in the store. Only supported whenConfluentLicenseStore.isEventBasedPropagationSupported()returns true.- Specified by:
setOnDataChangeListenerin interfaceConfluentLicenseStore- Parameters:
listener- the callback to invoke on data change, or null to clear
-
getInMemoryLicenses
Returns the current in-memory license state without any topic I/O. UnlikegetLatestLicenses()which callsreadToEnd()to ensure the consumer has caught up, this method reads directly from the in-memorylatestLicensesmap, which is kept up to date by the background WorkThread continuously polling the topic.Used by the event-based propagation path where the data has just been written to the map by
LicenseStore.ConsumeCallbackand blocking onreadToEnd()would be unnecessary.- Specified by:
getInMemoryLicensesin interfaceConfluentLicenseStore- Returns:
- map of deployment scope to license JWT, possibly empty
-
topic
Description copied from interface:ConfluentLicenseStoreLicenseStore falls back to_confluent-commandtopic if the topic given in the constructor doesn't exist, so this method provides the actual topic used by the license store.- Specified by:
topicin interfaceConfluentLicenseStore
-