예제 #1
0
 protected override async Task ExecuteAsync(CancellationToken stoppingToken)
 {
     // Keep running until asked to stop
     while (!stoppingToken.IsCancellationRequested)
     {
         try
         {
             await foreach (var package in _eventChannel.ReadAllAsync(stoppingToken))
             {
                 // Include the logic to proceed a package here.
                 // A package typical contains the actual event (or events) that the projection needs to project
                 _logger.LogInformation($"Package received: {package.EventName}");
             }
         }
         catch (Exception e)
         {
             _logger.LogError(e, "Bad thing happened");
         }
     }
 }