Class ConfigAgent

  • All Implemented Interfaces:
    com.yahoo.config.subscription.ConfigSubscriber.SingleSubscriber<MessagebusConfig>

    public class ConfigAgent
    extends Object
    implements com.yahoo.config.subscription.ConfigSubscriber.SingleSubscriber<MessagebusConfig>
    This class implements subscription to message bus config. To use configuration one must implement the ConfigHandler interface.
    Author:
    Simon Thoresen Hult
    • Constructor Detail

      • ConfigAgent

        public ConfigAgent​(String configId,
                           ConfigHandler handler)
        Create a config agent that will obtain config for the given handler and configure it programmatically.
        Parameters:
        configId - the config id we want to use
        handler - the handler that should be configured
      • ConfigAgent

        public ConfigAgent​(com.yahoo.config.subscription.ConfigURI configURI,
                           ConfigHandler handler)
        Create a config agent that will obtain config for the given handler and configure it programmatically.
        Parameters:
        configURI - the config URI we want to use
        handler - the handler that should be configured
      • ConfigAgent

        public ConfigAgent​(MessagebusConfig config,
                           ConfigHandler handler)
        Create a config agent that will configure the given handler with the given config.
        Parameters:
        config - the config we want to use
        handler - the handler that should be configured
    • Method Detail

      • reload

        public void reload​(long generation)
        Force reload config. Only necessary for testing or if subscribing to config using files.
      • subscribe

        public void subscribe()
        Start listening for config updates. This method will not return until the handler has been configured at least once unless an exception is thrown.
      • configure

        public void configure​(MessagebusConfig config)
        Specified by:
        configure in interface com.yahoo.config.subscription.ConfigSubscriber.SingleSubscriber<MessagebusConfig>
      • shutdown

        public void shutdown()
        Shuts down the config agent by unsubscribing to the messagebus config.