Exemplo n.º 1
0
        protected override async void Process(object state)
        {
            _logger.LogInformation("Running process iteration");

            using (var conn = await _connectionProvider.GetOpenConnectionAsync())
            {
                // 1. Get all fixtures that should've finished by now that we didn't save yet
                var fixtureIds = await _fixtureRepository.GetFixturesToCheckAsync(conn);

                _logger.LogInformation($"Found {fixtureIds.Count} to process");

                // 2. Send an AMQP message to request the details be updated
                foreach (var fixtureId in fixtureIds)
                {
                    var message = new GetFixtureDetailsMessage();
                    message.FixtureId = fixtureId;

                    _amqpService.Send(message, RoutingKey.FixtureDetails);
                }

                _logger.LogInformation($"Sent {fixtureIds.Count} AMQP messages to request fixture details");
            }
        }