EcovadisCode / Ev.ServiceBus

A wrapper to use Azure Service Bus in a ASP.NET Core project
MIT License
20 stars 9 forks source link

feature(#72) Improve Logging: Fix Duplicate Entries, Implement High-… #74

Closed Bchir closed 2 months ago

Bchir commented 3 months ago

To use OpenTelemetry

  builder.WithTracing(tracing =>
        {
            tracing
                .AddSource("Ev.ServiceBus")
       });

To use Elastic APM you can use the new method UseApm

  services.AddServiceBus(settings => {
        settings.Enabled = true;
        settings.ReceiveMessages = true;
        settings.WithConnection("", new ServiceBusClientOptions());
    }).UseApm();

[Breaking] The exception catched during IMessageHandler was changed to FailedToProcessMessageException Original exception is stored in the inner exception if you are using IExceptionHandler use this to get original message

public class CustomExceptionHandler : IExceptionHandler
{
    public Task HandleExceptionAsync(ProcessErrorEventArgs args)
    {
            var original = exceptionEvent.Exception is FailedToProcessMessageException wrapperException
                ? wrapperException.InnerException!
                : exceptionEvent.Exception!;
        return Task.CompletedTask;
    }
}
benspeth commented 2 months ago

merged in another PR