public IRouteCoordinator Create()
        {
            var connectionStr = NRpcConfigWatcher.CurrentConfig.Zookeeper.Connection;
            var parentName    = NRpcConfigWatcher.CurrentConfig.Zookeeper.ParentName;

            Ensure.NotNullAndNotEmpty(connectionStr, "NRpc:Zookeeper:Connection");
            Ensure.NotNullAndNotEmpty(parentName, "NRpc:Zookeeper:ParentName");
            var option = new RouteCoordinatorOption
            {
                ConnectionString = connectionStr,
                ParentName       = parentName
            };

            return(new ZkCoordinator(option));
        }
示例#2
0
        public IRouteCoordinator Create()
        {
            var config        = _remoteEndPointConfigProvider.GetConfig();
            var connectionStr = config?.Zookeeper?.Connection;
            var parentName    = config?.Zookeeper?.ParentName;

            Ensure.NotNullAndNotEmpty(connectionStr, "NetCoreRpc:Zookeeper:Connection");
            Ensure.NotNullAndNotEmpty(parentName, "NetCoreRpc:Zookeeper:ParentName");
            var option = new RouteCoordinatorOption
            {
                ConnectionString = connectionStr,
                ParentName       = parentName
            };

            return(new ZkCoordinator(option));
        }
示例#3
0
 public ZkManager(RouteCoordinatorOption zkOption, Func <WatchedEvent, ZkManager, Task> changeEvent)
 {
     _zkOption    = zkOption;
     _changeEvent = changeEvent;
     _zooKeeper   = CreateZk();
 }
示例#4
0
 public ZkCoordinator(RouteCoordinatorOption routeCoordinatorOption)
 {
     _routeCoordinatorOption = routeCoordinatorOption;
     _zkManager = new ZkManager(routeCoordinatorOption, NodeChangedAsync);
 }