Example #1
0
        private async Task StartAsync(
            Application.IQueryable <MongoService, Service> queryableServices,
            IRegisterable <Service> registerableService,
            HttpClient client)
        {
            while (true)
            {
                var registeredServices = await queryableServices.Query(_ => true);

                foreach (var s in registeredServices)
                {
                    var updatedService = new Service(
                        s.Id,
                        s.Name,
                        s.DocumentationUrl,
                        s.StatusUrl,
                        await new HeartbeatableService(s, client).Status
                        );
                    await registerableService.Register(updatedService);
                }
                await Task.Delay(TimeSpan.FromMinutes(5));
            }
        }
Example #2
0
 public ServicesController(IRegisterable <Service> upsertableService, Application.IQueryable <MongoService, Service> findableService)
 {
     _upsertableService = upsertableService;
     _findableService   = findableService;
 }