Class ConfigAgent

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

    public class ConfigAgent
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      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.
      ConfigAgent​(MessagebusConfig config, ConfigHandler handler)
      Create a config agent that will configure the given handler with the given config.
      ConfigAgent​(java.lang.String configId, ConfigHandler handler)
      Create a config agent that will obtain config for the given handler and configure it programmatically.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void configure​(MessagebusConfig config)  
      void reload​(long generation)
      Force reload config.
      void shutdown()
      Shuts down the config agent by unsubscribing to the messagebus config.
      void subscribe()
      Start listening for config updates.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfigAgent

        public ConfigAgent​(java.lang.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.