Exemplo n.º 1
0
        async Task DoLogging(Exception exception, FailedErrorImport failure)
        {
            var id = Guid.NewGuid();

            // Write to Raven
            using (var session = store.OpenAsyncSession())
            {
                failure.Id = id;

                await session.StoreAsync(failure)
                .ConfigureAwait(false);

                await session.SaveChangesAsync()
                .ConfigureAwait(false);
            }

            // Write to Log Path
            var filePath = Path.Combine(logPath, failure.Id + ".txt");

            File.WriteAllText(filePath, exception.ToFriendlyString());

            // Write to Event Log
            await WriteEvent("A message import has failed. A log file has been written to " + filePath)
            .ConfigureAwait(false);
        }
Exemplo n.º 2
0
 async Task Handle(Exception exception, FailedErrorImport failure)
 {
     try
     {
         await DoLogging(exception, failure)
         .ConfigureAwait(false);
     }
     finally
     {
         failureCircuitBreaker.Increment(exception);
     }
 }
Exemplo n.º 3
0
        public Task Handle(ErrorContext errorContext)
        {
            var failure = new FailedErrorImport
            {
                Message = new FailedTransportMessage
                {
                    Id      = errorContext.Message.MessageId,
                    Headers = errorContext.Message.Headers,
                    Body    = errorContext.Message.Body
                }
            };

            return(Handle(errorContext.Exception, failure));
        }