Example #1
0
 public ZookeeperClientProvider(ConfigInfo config, ILogger <ZookeeperClientProvider> logger)
 {
     _config = config;
     _logger = logger;
 }
Example #2
0
 public static ContainerBuilder UseZooKeeperManager(this ContainerBuilder builder, ConfigInfo configInfo)
 {
     return(builder.UseZooKeeperRouteManager(configInfo)
            .UseZookeeperClientProvider(configInfo));
 }
Example #3
0
 public static ContainerBuilder UseZookeeperClientProvider(this ContainerBuilder builder, ConfigInfo configInfo)
 {
     builder.Register(provider =>
                      new ZookeeperClientProvider(
                          configInfo,
                          provider.Resolve <ILogger <ZookeeperClientProvider> >())).SingleInstance();
     return(builder);
 }
Example #4
0
 /// <summary>
 /// 设置共享文件路由管理者。
 /// </summary>
 /// <param name="builder">Rpc服务构建者。</param>
 /// <param name="configInfo">ZooKeeper设置信息。</param>
 /// <returns>服务构建者。</returns>
 public static ContainerBuilder UseZooKeeperRouteManager(this ContainerBuilder builder, ConfigInfo configInfo)
 {
     builder.RegisterAdapter(new Func <IServiceProvider, IServiceRouteManager>(provider =>
                                                                               new ZooKeeperServiceRouteManager(
                                                                                   configInfo,
                                                                                   provider.GetRequiredService <ISerializer <byte[]> >(),
                                                                                   provider.GetRequiredService <ILogger <ZooKeeperServiceRouteManager> >(),
                                                                                   provider.GetRequiredService <ZookeeperClientProvider>()))).InstancePerLifetimeScope();
     return(builder);
 }