|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Confluent.Kafka; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Logging.Abstractions; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using Volo.Abp.Data; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
@ -11,9 +13,12 @@ namespace Volo.Abp.EventBus.Kafka |
|
|
|
{ |
|
|
|
public class KafkaEventErrorHandler : EventErrorHandlerBase, ISingletonDependency |
|
|
|
{ |
|
|
|
protected ILogger<KafkaEventErrorHandler> Logger { get; set; } |
|
|
|
|
|
|
|
public KafkaEventErrorHandler( |
|
|
|
IOptions<AbpEventBusOptions> options) : base(options) |
|
|
|
{ |
|
|
|
Logger = NullLogger<KafkaEventErrorHandler>.Instance; |
|
|
|
} |
|
|
|
|
|
|
|
protected override async Task Retry(EventExecutionErrorContext context) |
|
|
|
@ -34,6 +39,10 @@ namespace Volo.Abp.EventBus.Kafka |
|
|
|
|
|
|
|
protected override async Task MoveToDeadLetter(EventExecutionErrorContext context) |
|
|
|
{ |
|
|
|
Logger.LogException( |
|
|
|
context.Exceptions.Count == 1 ? context.Exceptions.First() : new AggregateException(context.Exceptions), |
|
|
|
LogLevel.Error); |
|
|
|
|
|
|
|
await context.EventBus.As<KafkaDistributedEventBus>().PublishToDeadLetterAsync( |
|
|
|
context.EventType, |
|
|
|
context.EventData, |
|
|
|
|