예제 #1
0
        internal static ZooKeeperClientConfigure ReadZooKeeperClientConfigure(IConfigurationSection configurationSection)
        {
            var client = new ZooKeeperClientConfigure();

            if (configurationSection.Exists())
            {
                var connection = configurationSection.GetSection("ConnectionString");
                if (connection.Exists())
                {
                    client.ConnectionString = connection.Value;
                }
                var sessionTimeout = configurationSection.GetSection("SessionTimeout");
                if (sessionTimeout.Exists())
                {
                    client.SessionTimeout = int.Parse(sessionTimeout.Value);
                }

                var canBeReadOnly = configurationSection.GetSection("CanBeReadOnly");
                if (canBeReadOnly.Exists())
                {
                    client.CanBeReadOnly = bool.Parse(canBeReadOnly.Value);
                }
            }
            return(client);
        }
예제 #2
0
 public static void AddZooKeeper(this IUraganoBuilder builder, ZooKeeperClientConfigure zookeeperClientConfiguration)
 {
     builder.AddServiceDiscovery <ZooKeeperServiceDiscovery>(zookeeperClientConfiguration);
 }