Package org.apache.druid.client
Class BaseBrokerViewOfConfig<DynamicConfig>
java.lang.Object
org.apache.druid.client.BaseBrokerViewOfConfig<DynamicConfig>
- Type Parameters:
DynamicConfig- the type of dynamic configuration (e.g., CoordinatorDynamicConfig, BrokerDynamicConfig)
- Direct Known Subclasses:
BrokerViewOfBrokerConfig,BrokerViewOfCoordinatorConfig
Base class for broker's view of dynamic configuration fetched from the Coordinator.
Subclasses must implement:
fetchConfigFromClient() to fetch configuration from their specific client
getConfigTypeName() for logging purposes-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract DynamicConfigFetch the configuration from the Coordinator via the HTTP client.protected abstract StringE.g., "coordinator dynamic configuration", "broker dynamic configuration"Return the current dynamic configuration.voidsetDynamicConfig(DynamicConfig updatedConfig) Update the config view with a new dynamic config snapshot.voidstart()Fetch the initial configuration from the Coordinator on broker startup.
-
Constructor Details
-
BaseBrokerViewOfConfig
public BaseBrokerViewOfConfig()
-
-
Method Details
-
fetchConfigFromClient
Fetch the configuration from the Coordinator via the HTTP client. This is called once during broker startup.- Returns:
- the configuration fetched from the Coordinator
- Throws:
Exception- if the fetch fails
-
getConfigTypeName
E.g., "coordinator dynamic configuration", "broker dynamic configuration" -
getDynamicConfig
Return the current dynamic configuration. -
setDynamicConfig
Update the config view with a new dynamic config snapshot. This is called when the Coordinator pushes a configuration update to this broker.- Parameters:
updatedConfig- the new configuration snapshot
-
start
public void start()Fetch the initial configuration from the Coordinator on broker startup. If the fetch fails, the broker startup will fail with a RuntimeException, preventing the broker from serving queries with stale or missing configuration.
-