Package com.yahoo.messagebus
Class ConfigAgent
java.lang.Object
com.yahoo.messagebus.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 Summary
ConstructorDescriptionConfigAgent
(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
(String configId, ConfigHandler handler) Create a config agent that will obtain config for the given handler and configure it programmatically. -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(MessagebusConfig config) void
reload
(long generation) Force reload config.void
shutdown()
Shuts down the config agent by unsubscribing to the messagebus config.void
Start listening for config updates.
-
Constructor Details
-
ConfigAgent
Create a config agent that will obtain config for the given handler and configure it programmatically.- Parameters:
configId
- the config id we want to usehandler
- the handler that should be configured
-
ConfigAgent
Create a config agent that will obtain config for the given handler and configure it programmatically.- Parameters:
configURI
- the config URI we want to usehandler
- the handler that should be configured
-
ConfigAgent
Create a config agent that will configure the given handler with the given config.- Parameters:
config
- the config we want to usehandler
- the handler that should be configured
-
-
Method Details
-
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
- Specified by:
configure
in interfacecom.yahoo.config.subscription.ConfigSubscriber.SingleSubscriber<MessagebusConfig>
-
shutdown
public void shutdown()Shuts down the config agent by unsubscribing to the messagebus config.
-