protected virtual Service CreateService(AgentServiceMap agentMap, ServiceMap serviceMap)
        {
            if (agentMap.Tags.Item1 == "thrift")
            {
                return(new ThriftService
                {
                    Address = agentMap.Service.Address,
                    Name = agentMap.Service.ID,
                    Port = agentMap.Service.Port,
                    ServiceType = serviceMap.Implement
                });
            }

            return(null);
        }
        public IEnumerable <Service> Discover(IEnumerable <ServiceMap> serviceMaps)
        {
            List <Service>         servicesList = new List <Service>();
            List <AgentServiceMap> serivces     = GetServicesFromConsul();

            foreach (ServiceMap serviceMap in serviceMaps)
            {
                AgentServiceMap agentMap = serivces.SingleOrDefault(tmp => serviceMap.InheritInterface(tmp.Tags.Item2));
                if (agentMap != null)
                {
                    Service usableService = CreateService(agentMap, serviceMap);
                    if (usableService != null)
                    {
                        servicesList.Add(usableService);
                    }
                }
            }

            return(servicesList);
        }