Class DirectoryConfigProvider

java.lang.Object
org.apache.kafka.common.config.provider.DirectoryConfigProvider
All Implemented Interfaces:
Closeable, AutoCloseable, ConfigProvider, Configurable

public class DirectoryConfigProvider extends Object implements ConfigProvider
An implementation of ConfigProvider based on a directory of files. Property keys correspond to the names of the regular (i.e. non-directory) files in a directory given by the path parameter. Property values are taken from the file contents corresponding to each key.
  • Field Details

  • Constructor Details

    • DirectoryConfigProvider

      public DirectoryConfigProvider()
  • Method Details

    • configure

      public void configure(Map<String,?> configs)
      Description copied from interface: Configurable
      Configure this class with the given key-value pairs
      Specified by:
      configure in interface Configurable
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • get

      public ConfigData get(String path)
      Retrieves the data contained in regular files in the directory given by path. Non-regular files (such as directories) in the given directory are silently ignored.
      Specified by:
      get in interface ConfigProvider
      Parameters:
      path - the directory where data files reside.
      Returns:
      the configuration data.
    • get

      public ConfigData get(String path, Set<String> keys)
      Retrieves the data contained in the regular files named by keys in the directory given by path. Non-regular files (such as directories) in the given directory are silently ignored.
      Specified by:
      get in interface ConfigProvider
      Parameters:
      path - the directory where data files reside.
      keys - the keys whose values will be retrieved.
      Returns:
      the configuration data.