Exemplo n.º 1
0
 /// <summary>
 /// Consul Register
 /// </summary>
 /// <param name="client"></param>
 public void ServiceRegister()
 {
     try
     {
         var clients = new ConsulClient(ConfigurationOverview);
         _AgentServiceRegistration = new AgentServiceRegistration()
         {
             Address = HostsEnv.GetIPAddress(),
             ID      = "gbdeviceservice",//"gb28181" + Dns.GetHostName(),
             Name    = "gbdeviceservice",
             Port    = EnvironmentVariables.GBServerGrpcPort,
             Tags    = new[] { "gb28181" }
         };
         var result = clients.Agent.ServiceRegister(_AgentServiceRegistration).Result;
     }
     catch (Exception ex)
     {
         logger.Error("Consul Register: " + ex.Message);
         throw ex;
     }
 }
Exemplo n.º 2
0
 private void ConfigurationOverview(ConsulClientConfiguration obj)
 {
     obj.Address = new Uri("http://" + (EnvironmentVariables.MicroRegistryAddress ?? HostsEnv.GetIPAddress() + ":8500"));
     logger.Debug("Consul Client: " + obj.Address);
     obj.Datacenter = "dc1";
 }