示例#1
0
        public ZKConfigurationProvider(ZKConfigurationOption option, AlwaysOnZooKeeperClient client,
                                       IDataSerializer serializeProvider = null,
                                       Encoding encoding = null)
        {
            this._option     = option;
            this._client     = client;
            this._serializer = serializeProvider;
            this._encoding   = encoding ?? Encoding.UTF8;

            this._node_watcher = new CallBackWatcher(this.NodeWatchCallback);
        }
示例#2
0
        public static IConfigurationBuilder AddZookeeper(
            this IConfigurationBuilder builder,
            AlwaysOnZooKeeperClient client,
            CancellationToken cancellationToken,
            Func <ZKConfigurationOption, ZKConfigurationOption> config = null)
        {
            var option = new ZKConfigurationOption();

            if (config != null)
            {
                option = config.Invoke(option);
            }

            var zkConfigSource = new ZKConfigurationSource(option, client, cancellationToken);

            return(builder.Add(zkConfigSource));
        }
示例#3
0
 public ZKConfigurationSource(ZKConfigurationOption option, AlwaysOnZooKeeperClient client, CancellationToken cancellationToken)
 {
     this._provider = new ZKConfigurationProvider(option, client);
 }