Class BrokerConfigTenantConfigSource

java.lang.Object
io.confluent.kafka.multitenant.metadata.BrokerConfigTenantConfigSource
All Implemented Interfaces:
org.apache.kafka.common.Configurable, org.apache.kafka.common.Reconfigurable, org.apache.kafka.server.multitenant.TenantConfigSource

public class BrokerConfigTenantConfigSource extends Object implements org.apache.kafka.server.multitenant.TenantConfigSource, org.apache.kafka.common.Reconfigurable
A TenantConfigSource that returns a tenant-independent TenantConfig derived from selected broker-level configs.

Thread-safety: configFor(String) runs on broker request-handling threads while reconfigure(Map) / configure(Map) run on the dynamic-config update path. The shared view is published through a volatile reference; the caller-supplied isTenantPresent predicate is invoked from configFor and so must itself be safe for concurrent reads. The tenantConfigNameToBrokerConfigName mapping is defensively copied at construction and only read thereafter.

  • Constructor Details

    • BrokerConfigTenantConfigSource

      public BrokerConfigTenantConfigSource(Predicate<String> isTenantPresent, Map<String,String> tenantConfigNameToBrokerConfigName)
      Parameters:
      isTenantPresent - must be thread-safe; called from configFor(String) on broker request-handling threads. Used to enforce the TenantConfigSource contract that configFor returns Optional.empty() for tenants not present on the broker.
      tenantConfigNameToBrokerConfigName - mapping from tenant config keys to the broker config keys whose values should be returned as the tenant config value. Defensively copied. The mapping must be injective on the broker side: a single broker config cannot back two tenant configs (we reject this at construction rather than silently fan it out).
  • Method Details

    • configFor

      public Optional<org.apache.kafka.server.multitenant.TenantConfig> configFor(String tenantId)
      Specified by:
      configFor in interface org.apache.kafka.server.multitenant.TenantConfigSource
    • reconfigurableConfigs

      public Set<String> reconfigurableConfigs()
      Specified by:
      reconfigurableConfigs in interface org.apache.kafka.common.Reconfigurable
    • validateReconfiguration

      public void validateReconfiguration(Map<String,?> configs) throws org.apache.kafka.common.config.ConfigException
      Specified by:
      validateReconfiguration in interface org.apache.kafka.common.Reconfigurable
      Throws:
      org.apache.kafka.common.config.ConfigException
    • reconfigure

      public void reconfigure(Map<String,?> configs)
      Specified by:
      reconfigure in interface org.apache.kafka.common.Reconfigurable
    • configure

      public void configure(Map<String,?> configs)
      Specified by:
      configure in interface org.apache.kafka.common.Configurable