/// <summary> /// 添加Zookeeper配置 /// </summary> /// <param name="builder"></param> /// <param name="zookeeperOptions"></param> public static IConfigurationBuilder AddZookeeper(this IConfigurationBuilder builder, ZookeeperOptions zookeeperOptions) { ZookeeperConfigurationSource zookeeperConfigurationSource = new ZookeeperConfigurationSource(zookeeperOptions); builder.Add(zookeeperConfigurationSource); return(builder); }
public ZookeeperConfigurationProvider(ZookeeperConfigurationSource zookeeperConfigurationSource) { this.ZookeeperConfigurationSource = zookeeperConfigurationSource; this.zookeeperConfigurationWatcher = new ZookeeperConfigurationWatcher(this); if (zookeeperConfigurationSource.ZookeeperOptions.ReloadOnChange) { _changeTokenRegistration = ChangeToken.OnChange( () => GetReloadToken(), () => { Thread.Sleep(zookeeperConfigurationSource.ZookeeperOptions.ReloadDelay); Load(); }); } }