Example #1
0
        public static async Task <dynamic> CatchupStatus()
        {
            if (GetEventStoreDbContext() == null)
            {
                return("GetEventStoreDbContext on class Microsoft.Its.Domain.Sql.Sensors is not configured");
            }

            var latestEventId = Task.Run(() =>
            {
                using (var eventStore = GetEventStoreDbContext())
                {
                    return(eventStore.Events
                           .OrderByDescending(e => e.Id)
                           .Select(e => e.Id)
                           .FirstOrDefault());
                }
            });

            return(new
            {
                LatestEventId = await latestEventId,
                ReadModels = ReadModelDbContexts.ToDictionary(p => p.Key,
                                                              p => EventHandlerProgressCalculator.Calculate(p.Value, GetEventStoreDbContext))
            });
        }
Example #2
0
        public static async Task <dynamic> CatchupStatus()
        {
            if (GetEventStoreDbContext == null)
            {
                return("GetEventStoreDbContext on class Microsoft.Its.Domain.Sql.Sensors is not configured");
            }

            using (var eventStore = GetEventStoreDbContext())
            {
                return(new
                {
                    LatestEventId = await eventStore
                                    .Events
                                    .MaxAsync(e => e.Id),
                    ReadModels = ReadModelDbContexts
                                 .ToDictionary(p => p.Key,
                                               p => EventHandlerProgressCalculator.CalculateProgress(p.Value, GetEventStoreDbContext))
                });
            }
        }