public virtual async Task RegisterRpcRoutes(double processorTime, ServiceProtocol serviceProtocol)
        {
            var hostAddr            = NetUtil.GetRpcAddressModel();
            var localServiceEntries = _serviceEntryManager.GetLocalEntries()
                                      .Where(p => p.ServiceDescriptor.ServiceProtocol == serviceProtocol);
            var serviceRouteDescriptors = localServiceEntries.Select(p => p.CreateLocalRouteDescriptor());

            await RegisterRoutes(serviceRouteDescriptors, hostAddr.Descriptor);
        }
Exemple #2
0
        public ServiceEntry GetLocalServiceEntryById(string serviceId)
        {
            if (_serviceEntryCache.TryGetLocalServiceEntry(serviceId, out ServiceEntry serviceEntry))
            {
                return(serviceEntry);
            }

            serviceEntry = _serviceEntryManager.GetLocalEntries()
                           .FirstOrDefault(p => p.ServiceDescriptor.Id == serviceId);
            if (serviceEntry != null)
            {
                _serviceEntryCache.UpdateLocalServiceEntryCache(serviceEntry);
            }

            return(serviceEntry);
        }