Ejemplo n.º 1
0
        private async Task ProcessErrorAsync(ProcessErrorEventArgs args)
        {
            if (args?.Exception is null)
            {
                Logger.LogWarning("Thrown exception on Azure Service Bus message pump '{JobId}' was null, skipping", JobId);
                return;
            }

            try
            {
                await HandleReceiveExceptionAsync(args.Exception);
            }
            finally
            {
                if (args.Exception is UnauthorizedAccessException)
                {
                    if (Interlocked.Increment(ref _unauthorizedExceptionCount) >= Settings.Options.MaximumUnauthorizedExceptionsBeforeRestart)
                    {
                        Logger.LogTrace("Unable to connect anymore to Azure Service Bus, trying to re-authenticate...");
                        await RestartAsync();
                    }
                    else
                    {
                        Logger.LogWarning("Unable to connect anymore to Azure Service Bus ({CurrentCount}/{MaxCount})",
                                          _unauthorizedExceptionCount, Settings.Options.MaximumUnauthorizedExceptionsBeforeRestart);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 static Task ProcessErrorHandler(ProcessErrorEventArgs eventArgs)
 {
     // Write details about the error to the console window
     Console.WriteLine($"\tPartition '{ eventArgs.PartitionId}': an unhandled exception was encountered. This was not expected to happen.");
     Console.WriteLine(eventArgs.Exception.Message);
     return(Task.CompletedTask);
 }
Ejemplo n.º 3
0
        private Task ProcessErrorHandler(ProcessErrorEventArgs eventArgs)
        {
            _logger.LogError($"\n\nERROR: Partition: '{eventArgs.PartitionId}': an unhandled exception was encountered.\n\n");
            _logger.LogError(eventArgs.Exception.Message);

            return(Task.CompletedTask);
        }
Ejemplo n.º 4
0
        private static Task Error_Handler(ProcessErrorEventArgs eventArgs)
        {
            Console.WriteLine("An Error has occurred");
            Console.WriteLine(eventArgs.Exception.Message);

            return(Task.CompletedTask);
        }
Ejemplo n.º 5
0
        private Task ProcessErrorHandler(ProcessErrorEventArgs eventArgs)
        {
            // Write details about the error to the console window
            logger.LogError(eventArgs.Exception, $"Partition '{ eventArgs.PartitionId}': an unhandled exception was encountered. This was not expected to happen.");

            return(Task.CompletedTask);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Event handler that logs errors from EventProcessorClient
 /// </summary>
 /// <param name="arg">Error event args</param>
 /// <returns>Completed Task, no async work needed</returns>
 private Task Client_ProcessErrorAsync(ProcessErrorEventArgs arg)
 {
     _logger.LogError(arg.Exception, "Issue reported by EventProcessorClient, partition {PartitionId}, operation {Operation}",
                      arg.PartitionId,
                      arg.Operation);
     return(Task.CompletedTask);
 }
Ejemplo n.º 7
0
        private static Task ProcessErrorHandler(ProcessErrorEventArgs arg)
        {
            Console.WriteLine($"\tPartition '{ arg.PartitionId}': an unhandled exception was encountered.");
            Console.WriteLine(arg.Exception.Message);

            return(Task.CompletedTask);
        }
 async Task OnError(ProcessErrorEventArgs arg)
 {
     if (ProcessError != null)
     {
         await ProcessError.Invoke(arg).ConfigureAwait(false);
     }
 }
Ejemplo n.º 9
0
        private Task ProcessErrorHandler(ProcessErrorEventArgs args)
        {
            try
            {
                var eventHubsException = (args.Exception as EventHubsException);
                eventHubsException?.TrackMetrics(Metrics);

                if (eventHubsException == null)
                {
                    Interlocked.Increment(ref Metrics.GeneralExceptions);
                }

                Interlocked.Increment(ref Metrics.TotalExceptions);
                Interlocked.Increment(ref Metrics.ProcessingExceptions);
                ErrorsObserved.Add(args.Exception);
            }
            catch (EventHubsException ex)
            {
                Interlocked.Increment(ref Metrics.TotalExceptions);
                ex.TrackMetrics(Metrics);
                ErrorsObserved.Add(ex);
            }
            catch (Exception ex)
            {
                Interlocked.Increment(ref Metrics.TotalExceptions);
                Interlocked.Increment(ref Metrics.GeneralExceptions);
                ErrorsObserved.Add(ex);
            }

            return(Task.CompletedTask);
        }
Ejemplo n.º 10
0
        private static Task EventProcessorClient_ProcessErrorAsync(ProcessErrorEventArgs arg)
        {
            // WRITE TO LOG
            Console.WriteLine($"\tPartition {arg.PartitionId} : Error");
            Console.WriteLine($"{arg.Exception.Message}");

            return(Task.CompletedTask);
        }
Ejemplo n.º 11
0
        static Task ActionErreurReception(ProcessErrorEventArgs args)
        {
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("Une erreur est survenue lors de la reception du message : " + args.Exception.ToString());
            Console.ForegroundColor = ConsoleColor.White;

            return(Task.CompletedTask);
        }
        private async Task _processor_ProcessErrorAsync(ProcessErrorEventArgs arg)
        {
            EndedHow = Ended.Error;

            _wait.Set();

            await Task.CompletedTask;
        }
 private Task ClientOnProcessErrorAsync(ProcessErrorEventArgs arg)
 {
     if (!(arg.Exception is OperationCanceledException))
     {
         _log.Error(arg.Exception, $"{typeof(ServiceBusTopicChannelReceiver<TTopic>).Name}");
     }
     return(Task.CompletedTask);
 }
Ejemplo n.º 14
0
    /// <summary>
    ///   The method to pass to the <see cref="EventProcessorClient" /> instance as the <see cref="EventProcessorClient.ProcessErrorAsync" />
    ///   event handler.
    /// </summary>
    ///
    /// <param name="args">The <see cref="ProcessErrorEventArgs" /> used to pass information to the errpr handler.</param>
    ///
    private Task ProcessErrorHandler(ProcessErrorEventArgs args)
    {
        var exceptionProperties = new Dictionary <string, string>();

        exceptionProperties.Add(Metrics.TestName, _testName);
        _metrics.Client.TrackException(args.Exception, exceptionProperties);
        return(Task.CompletedTask);
    }
 private Task OnMessageFaultedAsync(ProcessErrorEventArgs args)
 {
     Logger.LogError(args.Exception,
                     "Message receiving faulted. Namespace:{FullyQualifiedNamespace}, Entity Path: {EntityPath}, Source: {ErrorSource}",
                     args.FullyQualifiedNamespace,
                     args.EntityPath,
                     args.ErrorSource);
     return(Task.CompletedTask);
 }
Ejemplo n.º 16
0
        private Task ProcessErrorHandler(ProcessErrorEventArgs e)
        {
            var partitionId = e.PartitionId;
            var operation   = e.Operation;

            Logger.LogError(e.Exception, $"Encountered an error during operation {operation} on partition {partitionId}.");

            return(Task.CompletedTask);
        }
Ejemplo n.º 17
0
 private static Task ErrorHandler(ProcessErrorEventArgs args, string subscription)
 {
     Console.WriteLine($"Received error on subscription {subscription}");
     Console.WriteLine(args.ErrorSource);
     Console.WriteLine(args.FullyQualifiedNamespace);
     Console.WriteLine(args.EntityPath);
     Console.WriteLine(args.Exception.ToString());
     return(Task.CompletedTask);
 }
Ejemplo n.º 18
0
 static Task ExceptionReceivedHandler(ProcessErrorEventArgs ex)
 {
     Console.WriteLine($"Message handler encountered an exception {ex.Exception}.");
     Console.WriteLine("Exception context for troubleshooting:");
     Console.WriteLine($"- ErrorSource: {ex.ErrorSource}");
     Console.WriteLine($"- Entity Path: {ex.EntityPath}");
     Console.WriteLine($"- Fully Qualified Namespace: {ex.FullyQualifiedNamespace}");
     return(Task.CompletedTask);
 }
Ejemplo n.º 19
0
 private async Task _processor_ProcessErrorAsync(ProcessErrorEventArgs arg)
 {
     _logger.Error(arg.Exception, $"Error ocurred at ServiceBusProcessor for queue {_queueName}. ErrorSource: {arg.ErrorSource}");
     if (arg.ErrorSource == ServiceBusErrorSource.AcceptSession || arg.ErrorSource == ServiceBusErrorSource.CloseSession)
     {
         _logger.Error(arg.Exception, $"Stopping ServiceBusProcessor for queue {_queueName}");
         await Stop(true);
     }
 }
 static Task ErrorHandler(ProcessErrorEventArgs args)
 {
     Console.WriteLine($"Message handler encountered an exception {args.Exception}.");
     Console.WriteLine("Exception context for troubleshooting:");
     Console.WriteLine($"- Endpoint: {args.FullyQualifiedNamespace}");
     Console.WriteLine($"- Entity Path: {args.EntityPath}");
     Console.WriteLine($"- Executing Action: {args.ErrorSource}");
     return(Task.CompletedTask);
 }
Ejemplo n.º 21
0
    private Task ErrorHandler(ProcessErrorEventArgs args)
    {
        var ex      = args.Exception;
        var context = args.ErrorSource;

        _logger.LogError(ex, "ERROR handling message: {ExceptionMessage} - Context: {@ExceptionContext}", ex.Message, context);

        return(Task.CompletedTask);
    }
Ejemplo n.º 22
0
        Task ExceptionReceivedHandler(ProcessErrorEventArgs args)
        {
            Log.Error(args.Exception,
                      $@"Message handler encountered an exception.
                        ErrorSource: {Enum.GetName(typeof(ServiceBusErrorSource), args.ErrorSource)}
                        Entity Path: {args.EntityPath}
                        Namespace: {args.FullyQualifiedNamespace}");

            return(Task.CompletedTask);
        }
        private Task ErrorHandlerAsync(ProcessErrorEventArgs arg)
        {
            _logger.LogError(arg.Exception, "Message handler encountered an exception");
            _logger.LogDebug($"- Error Source: {arg.ErrorSource}");
            _logger.LogDebug($"- Fully Qualified Namespace: {arg.FullyQualifiedNamespace}");
            _logger.LogDebug($"- Entity Path: {arg.EntityPath}");
            _logger.LogDebug($"- Exception: {arg.Exception.ToString()}");

            return(_serviceBusProcessor.CloseAsync());
        }
Ejemplo n.º 24
0
 private Task Processor_ProcessErrorAsync(ProcessErrorEventArgs arg)
 {
     return(eventBus.HandleError(
                new EventBusError(
                    Guid.NewGuid(),
                    arg.EntityPath,
                    DateTime.Now,
                    new AggregateException(arg.Exception)
                    )
                ));
 }
Ejemplo n.º 25
0
 private static Task processErrorHandler(ProcessErrorEventArgs eventArgs)
 {
     try
     {
         Console.WriteLine($"\n[ERROR] processErrorHandler -> Operation '{eventArgs.Operation}' from Partition {eventArgs.PartitionId} - {eventArgs.Exception.Message} ");
     }
     catch
     {
     }
     return(Task.CompletedTask);
 }
Ejemplo n.º 26
0
 private static Task ErrorHandler(ProcessErrorEventArgs args)
 {
     // the error source tells me at what point in the processing an error occurred
     Console.WriteLine(args.ErrorSource);
     // the fully qualified namespace is available
     Console.WriteLine(args.FullyQualifiedNamespace);
     // as well as the entity path
     Console.WriteLine(args.EntityPath);
     Console.WriteLine(args.Exception.ToString());
     return(Task.CompletedTask);
 }
Ejemplo n.º 27
0
        // Use this handler to examine the exceptions received on the message pump.
        private Task ExceptionReceivedHandler(ProcessErrorEventArgs e)
        {
            OnException?.Invoke(new Models.ServiceBusException
            {
                Exception = e.Exception,

                // Action = e.ExceptionReceivedContext.Action,
                // ClientId = e.ExceptionReceivedContext.ClientId,
                // Endpoint = e.FullyQualifiedNamespace,
                EntityPath = e.EntityPath,
            });
            return(Task.CompletedTask);
        }
Ejemplo n.º 28
0
 private Task ProcessErrorHandler(ProcessErrorEventArgs eventArgs)
 {
     try
     {
         // Write details about the error to the console window
         log.LogError($"\tPartition '{ eventArgs.PartitionId}': an unhandled exception was encountered. This was not expected to happen.");
         log.LogError(eventArgs.Exception.Message);
     }
     catch (Exception exe)
     {
         log.LogError($"Failure to process event error args: {exe.Message}");
     }
     return(Task.CompletedTask);
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Formats message.
 /// </summary>
 /// <param name="processErrorEventArgs">Message.</param>
 /// <returns>Formatted message.</returns>
 /// <exception cref="ArgumentNullException">processErrorEventArgs is null.</exception>
 public string Format(ProcessErrorEventArgs processErrorEventArgs)
 {
     if (processErrorEventArgs == null)
     {
         throw new ArgumentNullException("processErrorEventArgs",
                                         Resources.ArgumentNullException);
     }
     return(String.Format(CultureInfo.CurrentCulture,
                          @Resources.MessageProcessError,
                          @DateTime.Now,
                          @Resources.MessageTypeError,
                          @processErrorEventArgs.DaemonName,
                          @processErrorEventArgs.Exception.Message));
 }
Ejemplo n.º 30
0
        public void LogExceptionReceivedEvent_NonMessagingException_LoggedAsError()
        {
            var ex = new MissingMethodException("What method??");
            ProcessErrorEventArgs e = new ProcessErrorEventArgs(ex, ServiceBusErrorSource.Complete, "TestEndpoint", "TestEntity", CancellationToken.None);

            ServiceBusExtensionConfigProvider.LogExceptionReceivedEvent(e, _loggerFactory);

            var expectedMessage = $"Message processing error (Action=Complete, EntityPath=TestEntity, Endpoint=TestEndpoint)";
            var logMessage      = _loggerProvider.GetAllLogMessages().Single();

            Assert.AreEqual(LogLevel.Error, logMessage.Level);
            Assert.AreSame(ex, logMessage.Exception);
            Assert.AreEqual(expectedMessage, logMessage.FormattedMessage);
        }