public async Task SendMessageChunk() { try { _logger.LogInformation($"BusSenderService SendMessageChunk starting at: {DateTimeOffset.Now}"); var events = await _busEventRepository.GetEarliestUnProcessedEventChunk(); if (events.Any()) { _telemetryClient.TrackMetric("BusSender Chunk", events.Count); } _logger.LogInformation($"BusSenderService found {events.Count} messages to process"); foreach (var busEvent in events) { var message = JsonSerializer.Deserialize <BusEventMessage>(WashString(busEvent.Message)); if (message.ProjectName == null) { message.ProjectName = "_"; } TrackMetric(message); await _topicClients.SendAsync(busEvent.Event, WashString(busEvent.Message)); TrackEvent(busEvent.Event, message); busEvent.Sent = Status.Sent; await _unitOfWork.SaveChangesAsync(); } } catch (Exception exception) { _logger.LogError(exception, $"BusSenderService execute send failed at: {DateTimeOffset.Now}"); throw; } _logger.LogInformation($"BusSenderService SendMessageChunk finished at: {DateTimeOffset.Now}"); _telemetryClient.Flush(); }
int IVsSolutionEvents.OnAfterCloseSolution(object pUnkReserved) { TelemetryClient.Flush(); return(VSConstants.S_OK); }