public class TrialOnlyLicenseManager extends Object implements AddOnLicenseManager
The manager uses a delegate pattern internally, delegating most operations to a
LicenseManager configured specifically for trial only license management with
PRIMARY purpose.
| Constructor and Description |
|---|
TrialOnlyLicenseManager(ConfluentLicenseStore store,
org.apache.kafka.common.utils.Time time)
Create a new trial only license manager for testing purposes using a pre-configured
license store and time source.
|
TrialOnlyLicenseManager(String topic,
Map<String,Object> producerConfig,
Map<String,Object> consumerConfig,
Map<String,Object> topicConfig,
String licenseGuid)
Create a new trial only license manager that uses the specified topic for trial licenses,
with configurations for an admin client, producer, and consumer to create, write to,
and read from that topic in a Kafka cluster.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addListener(Consumer<LicenseChanged> listener) |
License |
registerOrValidateAddOnLicense(String license)
Register or validate only a trial license.
|
void |
start() |
void |
stop() |
public TrialOnlyLicenseManager(String topic, Map<String,Object> producerConfig, Map<String,Object> consumerConfig, Map<String,Object> topicConfig, String licenseGuid)
The trial only license store will be automatically started as part of construction.
Multiple components can use this manager with different licenseGuid values
to maintain separate trial licenses in the same Kafka topic. The GUID acts as a
partition key for license isolation.
topic - the name of the topic where only trial licenses are persisted; may not
be nullproducerConfig - the configuration for the producer used to write to the license topic;
may not be nullconsumerConfig - the configuration for the consumer used to read from the license topic;
may not be nulltopicConfig - the configuration for the admin client to create the license topic if
required; may not be nulllicenseGuid - the unique identifier for the license; may not be nullpublic TrialOnlyLicenseManager(ConfluentLicenseStore store, org.apache.kafka.common.utils.Time time)
This constructor is intended for unit testing and allows injection of mock dependencies to control behavior in tests.
store - the pre-configured license store to use; may not be nulltime - the time source to use for license validation; may not be nullpublic License registerOrValidateAddOnLicense(String license) throws InvalidLicenseException
registerOrValidateAddOnLicense in interface AddOnLicenseManagerlicense - the trial license string to validate, or empty/null to use stored licenseInvalidLicenseException - if the license is invalid, expired, or cannot be processedpublic void start()
start in interface AddOnLicenseManagerpublic void stop()
stop in interface AddOnLicenseManagerpublic boolean addListener(Consumer<LicenseChanged> listener)
addListener in interface AddOnLicenseManager