...
The public interfaces that are not Connect-specific consist of the following, which will be provided in the package org.apache.kafka.common.config:
ConfigProvider
,ConfigChangeCallback,
: These interfaces are used to abstract a provider of configuration properties.ConfigData
ConfigTransformer
: This class is used to provide variable substitution for a configuration value, by looking up variables (or indirect references) from a set ofConfigProvider
instances. It only provides one level of indirection.
The above classes will be in the package org.apache.kafka.common.config
, except for ConfigProvider
, which will be in the package org.apache.kafka.common.config.provider
, along with any implementations of ConfigProvider
(which is currently only FileConfigProvider
).
Code Block | ||
---|---|---|
| ||
public interface ConfigProvider extends Configurable, Closeable { // Configure this class with the initialization parameters void configure(Map<String, ?> configs); // Look up the data at the given path. ConfigData get(String path); // Look up the data with the given keys at the given path. ConfigData get(String path, Set<String> keys); // The ConfigProvider is responsible for making this callback whenever the key changes. // Some ConfigProviders may want to have a background thread with a configurable update interval. void subscribe(String path, Set<String> keys, ConfigChangeCallback callback); // Inverse of subscribe void unsubscribe(String path, Set<String> key, ConfigChangeCallback callback); // Remove all subscriptions void unsubscribeAll(); // Close all subscriptions and clean up all resources void close(); } public class ConfigData { private Long ttl; private Map<String, String> data; public ConfigData(Map<String, String> data, Long ttl) { this.ttl = ttl; this.data = data; } public ConfigData(Map<String, String> data) { this(null, data); } public Long ttl() { return ttl; } public Map<String, String> data() { return data; } } public interface ConfigChangeCallback { void onChange(String path, ConfigData data); } |
...