public void HandleEvent(ProjectionRunStarted eventHandled) { if (null != eventHandled) { #region Logging if (null != log) { log.LogDebug($"Query projection run started {eventHandled.ProjectionTypeName } for { eventHandled.DomainName }.{eventHandled.AggregateType}.{eventHandled.AggregateInstanceKey } as at {eventHandled.AsOfDate} in {nameof(Query_Projections_Projection)}"); } #endregion // remove this from this to the unprocessed list int unprocessedIndex = unprocessedRequests.FindIndex(f => f.DomainName == eventHandled.DomainName && f.AggregateType == eventHandled.AggregateType && f.AggregateInstanceKey == eventHandled.AggregateInstanceKey); if (unprocessedIndex >= 0) { unprocessedRequests.RemoveAt(unprocessedIndex); } if (IsValidRequest(eventHandled)) { // add it to the in-flight requests list inflightRequests.Add(eventHandled); } } }
private bool IsValidRequest(ProjectionRunStarted eventHandled) { if (null == eventHandled) { return(false); } if (string.IsNullOrWhiteSpace(eventHandled.DomainName)) { return(false); } if (string.IsNullOrWhiteSpace(eventHandled.AggregateType)) { return(false); } if (string.IsNullOrWhiteSpace(eventHandled.AggregateInstanceKey)) { return(false); } if (string.IsNullOrWhiteSpace(eventHandled.ProjectionTypeName)) { return(false); } return(true); }