Class CfgBuilderExtensions
CfgBuilder 的 Zookeeper 扩展方法
public static class CfgBuilderExtensions
- Inheritance
-
CfgBuilderExtensions
- Inherited Members
Methods
AddZookeeper(CfgBuilder, Action<ZookeeperCfgOptions>, int, bool)
添加 Zookeeper 配置源
public static CfgBuilder AddZookeeper(this CfgBuilder builder, Action<ZookeeperCfgOptions> configure, int level = 200, bool isPrimaryWriter = false)
Parameters
builderCfgBuilder配置构建器
configureAction<ZookeeperCfgOptions>配置选项
levelint配置层级,数值越大优先级越高,默认为 Zookeeper (15)
isPrimaryWriterbool是否为主写入源,默认为false
Returns
- CfgBuilder
配置构建器实例,支持链式调用
AddZookeeper(CfgBuilder, string, string, int, bool)
添加 Zookeeper 配置源(使用默认选项)
public static CfgBuilder AddZookeeper(this CfgBuilder builder, string connectionString, string rootPath = "/config", int level = 200, bool enableHotReload = true)
Parameters
builderCfgBuilder配置构建器
connectionStringstringZookeeper 连接字符串,如 localhost:2181
rootPathstring根路径,默认为 "/config"
levelint配置层级,数值越大优先级越高,默认为 Zookeeper (15)
enableHotReloadbool是否启用热重载,默认为true
Returns
- CfgBuilder
配置构建器实例,支持链式调用
AddZookeeperJson(CfgBuilder, string, string, int, bool)
添加 Zookeeper 配置源(JSON 格式)
public static CfgBuilder AddZookeeperJson(this CfgBuilder builder, string connectionString, string nodePath, int level = 200, bool enableHotReload = true)
Parameters
builderCfgBuilder配置构建器
connectionStringstringZookeeper 连接字符串
nodePathstring存储 JSON 配置的节点路径
levelint配置层级,数值越大优先级越高,默认为 Zookeeper (15)
enableHotReloadbool是否启用热重载,默认为true
Returns
- CfgBuilder
配置构建器实例,支持链式调用