Package com.yahoo.messagebus
Class ConfigAgent
java.lang.Object
com.yahoo.messagebus.ConfigAgent
- All Implemented Interfaces:
com.yahoo.config.subscription.ConfigSubscriber.SingleSubscriber<MessagebusConfig>
public final 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
ConstructorsConstructorDescriptionConfigAgent(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 TypeMethodDescriptionvoidconfigure(MessagebusConfig config) voidreload(long generation) Force reload config.voidshutdown()Shuts down the config agent by unsubscribing to the messagebus config.voidStart 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:
configurein interfacecom.yahoo.config.subscription.ConfigSubscriber.SingleSubscriber<MessagebusConfig>
-
shutdown
public void shutdown()Shuts down the config agent by unsubscribing to the messagebus config.
-