Exemplo n.º 1
0
        public MemberPublisher(string serviceName, IEndpointDiscovery dns)
        {
            _dns         = dns ?? throw new ArgumentNullException(nameof(dns));
            _serviceName = serviceName;

            _getActiveMember = "CommonStock/GetList/{0}/{1}";
        }
Exemplo n.º 2
0
        public IdentityTokenPublisher(string serviceName, IEndpointDiscovery dns)
        {
            _serviceName = serviceName;

            _dns = dns ?? throw new ArgumentNullException(nameof(dns));

            _postIdentityToken = "IdentityToken/Authen";
        }
Exemplo n.º 3
0
 /// <summary>
 /// Create services
 /// </summary>
 /// <param name="client"></param>
 /// <param name="events"></param>
 /// <param name="processor"></param>
 /// <param name="listener"></param>
 /// <param name="logger"></param>
 public DiscoveryServices(IEndpointDiscovery client, IEventEmitter events,
                          ITaskProcessor processor, ILogger logger, IDiscoveryListener listener = null)
 {
     _logger    = logger ?? throw new ArgumentNullException(nameof(logger));
     _client    = client ?? throw new ArgumentNullException(nameof(client));
     _events    = events ?? throw new ArgumentNullException(nameof(events));
     _processor = processor ?? throw new ArgumentNullException(nameof(processor));
     _listener  = listener ?? new DiscoveryLogger(_logger);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 添加ServiceDiscovery
        /// </summary>
        /// <param name="serviceDiscovery"></param>
        public void AddServiceDiscovery(IEndpointDiscovery serviceDiscovery)
        {
            if (serviceDiscovery == null)
            {
                return;
            }

            serviceDiscovery.Watched = () => GetSetCallInvokers(serviceDiscovery.Options.ServiceName, false);
            _discoveries.AddOrUpdate(serviceDiscovery.Options.ServiceName, serviceDiscovery, (k, v) => serviceDiscovery);
        }
Exemplo n.º 5
0
        public CommonStockPublisher(string serviceName, IEndpointDiscovery dns)
        {
            _dns             = dns ?? throw new ArgumentNullException(nameof(dns));
            _serviceName     = serviceName;
            _getCommonStocks = "CommonStock/GetList/{0}/{1}";
            _getInfo         = "CommonStock/GetInfo/{0}";

            _getStockDiscussion     = "CommonStock/{0}/discussion";
            _addStockDiscussionItem = "CommonStock/{0}/discussion";
        }
Exemplo n.º 6
0
 /// <summary>
 /// Create server
 /// </summary>
 /// <param name="modules"></param>
 /// <param name="identity"></param>
 /// <param name="methods"></param>
 /// <param name="discovery"></param>
 /// <param name="client"></param>
 /// <param name="logger"></param>
 public PublisherDiscovery(IModuleDiscovery modules, IIdentity identity,
                           IJsonMethodClient methods, IEndpointDiscovery discovery, IEndpointServices client,
                           ILogger logger)
 {
     _identity  = identity ?? throw new ArgumentNullException(nameof(identity));
     _methods   = methods ?? throw new ArgumentNullException(nameof(methods));
     _client    = client ?? throw new ArgumentNullException(nameof(client));
     _modules   = modules ?? throw new ArgumentNullException(nameof(modules));
     _discovery = discovery ?? throw new ArgumentNullException(nameof(discovery));
     _logger    = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemplo n.º 7
0
        /// <summary>
        /// Create services
        /// </summary>
        /// <param name="client"></param>
        /// <param name="events"></param>
        /// <param name="logger"></param>
        /// <param name="serializer"></param>
        /// <param name="progress"></param>
        public DiscoveryServices(IEndpointDiscovery client, IEventEmitter events,
                                 IJsonSerializer serializer, ILogger logger, IDiscoveryProgress progress = null)
        {
            _logger     = logger ?? throw new ArgumentNullException(nameof(logger));
            _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
            _client     = client ?? throw new ArgumentNullException(nameof(client));
            _events     = events ?? throw new ArgumentNullException(nameof(events));
            _progress   = progress ?? new ProgressLogger(logger);

            _runner = Task.Run(() => ProcessDiscoveryRequestsAsync(_cts.Token));
            _timer  = new Timer(_ => OnScanScheduling(), null,
                                TimeSpan.FromSeconds(20), Timeout.InfiniteTimeSpan);
        }
Exemplo n.º 8
0
 /// <summary>
 /// 添加ServiceDiscovery
 /// </summary>
 /// <param name="discovery"></param>
 public void AddServiceDiscovery(IEndpointDiscovery discovery)
 {
     _discoveries.AddOrUpdate(discovery.ServiceName, discovery, (k, v) => discovery);
 }
Exemplo n.º 9
0
 public EodPublisher(string serviceName, IEndpointDiscovery dns)
 {
     _dns         = dns ?? throw new ArgumentNullException(nameof(dns));
     _serviceName = serviceName;
     _getEods     = "Eod/GetList/{0}/{1}/{2}";
 }
Exemplo n.º 10
0
        public StockDiscussionPublisher(string serviceName, IEndpointDiscovery dns)
        {
            _serviceName = serviceName;

            _dns = dns ?? throw new ArgumentNullException(nameof(dns));
        }