Interface ConfigProvider
- All Superinterfaces:
AutoCloseable
,Closeable
,Configurable
- All Known Implementing Classes:
DirectoryConfigProvider
,EnvVarConfigProvider
,FileConfigProvider
A provider of configuration data, which may optionally support subscriptions to configuration changes.
Implementations are required to safely support concurrent calls to any of the methods in this interface.
Kafka Connect discovers implementations of this interface using the Java ServiceLoader
mechanism.
To support this, implementations of this interface should also contain a service provider configuration file in
META-INF/services/org.apache.kafka.common.config.provider.ConfigProvider
.
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the data at the given path.Retrieves the data with the given keys at the given path.default void
subscribe
(String path, Set<String> keys, ConfigChangeCallback callback) Subscribes to changes for the given keys at the given path (optional operation).default void
unsubscribe
(String path, Set<String> keys, ConfigChangeCallback callback) Unsubscribes to changes for the given keys at the given path (optional operation).default void
Clears all subscribers (optional operation).Methods inherited from interface org.apache.kafka.common.Configurable
configure
-
Method Details
-
get
Retrieves the data at the given path.- Parameters:
path
- the path where the data resides- Returns:
- the configuration data
-
get
Retrieves the data with the given keys at the given path.- Parameters:
path
- the path where the data resideskeys
- the keys whose values will be retrieved- Returns:
- the configuration data
-
subscribe
Subscribes to changes for the given keys at the given path (optional operation).- Parameters:
path
- the path where the data resideskeys
- the keys whose values will be retrievedcallback
- the callback to invoke upon change- Throws:
UnsupportedOperationException
- if the subscribe operation is not supported
-
unsubscribe
Unsubscribes to changes for the given keys at the given path (optional operation).- Parameters:
path
- the path where the data resideskeys
- the keys whose values will be retrievedcallback
- the callback to be unsubscribed from changes- Throws:
UnsupportedOperationException
- if the unsubscribe operation is not supported
-
unsubscribeAll
default void unsubscribeAll()Clears all subscribers (optional operation).- Throws:
UnsupportedOperationException
- if the unsubscribeAll operation is not supported
-