static void Main(string[] args) { DiscoveryClient.Initialize(); var discoveryClient = new DiscoveryClient(); using(var scenrio = new Scenarios.SingleServer.Scenario()) { var task = scenrio.StartScenrio(); task.Wait(); Console.WriteLine("Press Any Key"); string line; while ((line = Console.ReadLine()) != "") { if(line.StartsWith("quit")) return; if (line.StartsWith("discoverall")) { DiscoverAll(line.Split(' ').Skip(1).First(), discoveryClient); continue; } if (line.StartsWith("discover")) { Discover(line.Split(' ').Skip(1).First(), discoveryClient); continue; } if(line.StartsWith("requeston")) { RequestOn(line.Split(' ').Skip(1).First(), discoveryClient); continue; } if (line.StartsWith("services")) { ServicesList(discoveryClient); continue; } Logger.Info("unknown command"); } } }
static void DiscoverAll(string name, DiscoveryClient client) { var services = client.DiscoverAllByServiceIdentifier(name); foreach(var service in services) { Logger.Info("Found Service on {0} for {1}", service, name); } }
static void Discover(string name, DiscoveryClient client) { var service = client.DiscoverByServiceIdentifier(name); Logger.Info("Found Service on {0} for {1}", service, name); }