private async Task <TlsRptEntityHistoryState> LoadHistoryState(string id) { TlsRptEntityHistoryState tlsRptEntityHistoryState = await _dao.Get(id) ?? new TlsRptEntityHistoryState(id); return(tlsRptEntityHistoryState); }
public async Task Handle(DomainCreated message) { string messageId = message.Id.ToLower(); TlsRptEntityHistoryState state = await _dao.Get(messageId); if (state == null) { state = new TlsRptEntityHistoryState(messageId); await _dao.Save(state); _log.LogInformation("Created TlsRptHistoryEntity for {Id}.", messageId); } else { _log.LogWarning("Ignoring {EventName} as TlsRptHistoryEntity already exists for {Id}.", nameof(DomainCreated), messageId); } }
public async Task Handle(TlsRptRecordsPolled message) { string messageId = message.Id.ToLower(); TlsRptEntityHistoryState tlsRptEntityHistory = await LoadHistoryState(messageId); List <string> records = new List <string>(); message.TlsRptRecords?.Records.ForEach(x => records.Add(x.Record)); if (tlsRptEntityHistory.UpdateHistory(records, message.Timestamp)) { _log.LogInformation("TLS-RPT record has changed for {Id}", messageId); await _dao.Save(tlsRptEntityHistory); records.ForEach(x => _ruaService.Process(messageId, x)); } else { _log.LogInformation("No TLS-RPT Record change for {Id}", messageId); } }