From a5a55830b63556468d824346ecff808098e7667d Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 28 Jul 2021 12:00:42 +0800 Subject: [PATCH 1/2] Remove IJsonSerializer use in LocalEventBus --- .../Volo/Abp/EventBus/Local/LocalEventBus.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs index 16246a892f..3dc6045250 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs @@ -30,17 +30,13 @@ namespace Volo.Abp.EventBus.Local protected ConcurrentDictionary> HandlerFactories { get; } - protected IJsonSerializer Serializer { get; } - public LocalEventBus( IOptions options, IServiceScopeFactory serviceScopeFactory, ICurrentTenant currentTenant, - IEventErrorHandler errorHandler, - IJsonSerializer serializer) + IEventErrorHandler errorHandler) : base(serviceScopeFactory, currentTenant, errorHandler) { - Serializer = serializer; Options = options.Value; Logger = NullLogger.Instance; @@ -131,10 +127,9 @@ namespace Volo.Abp.EventBus.Local public virtual async Task PublishAsync(LocalEventMessage localEventMessage) { - var rawEventData = Serializer.Serialize(localEventMessage.EventData); await TriggerHandlersAsync(localEventMessage.EventType, localEventMessage.EventData, errorContext => { - errorContext.EventData = Serializer.Deserialize(localEventMessage.EventType, rawEventData); + errorContext.EventData = localEventMessage.EventData; errorContext.SetProperty(nameof(LocalEventMessage.MessageId), localEventMessage.MessageId); }); } From 1c99daddf26647e60110385286474c990d166053 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 28 Jul 2021 12:22:06 +0800 Subject: [PATCH 2/2] Fix unit tests --- .../Abp/EventBus/Local/EventBus_Exception_Handler_Tests.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Handler_Tests.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Handler_Tests.cs index d6b61ee863..3ed0ff19f9 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Handler_Tests.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Handler_Tests.cs @@ -33,9 +33,7 @@ namespace Volo.Abp.EventBus.Local LocalEventBus.Subscribe(eventData => { eventData.Value.ShouldBe(0); - retryAttempt++; - eventData.Value++; if (retryAttempt < 2) { throw new Exception("This exception is intentionally thrown!"); @@ -58,7 +56,6 @@ namespace Volo.Abp.EventBus.Local eventData.Value.ShouldBe(0); retryAttempt++; - eventData.Value++; throw new Exception("This exception is intentionally thrown!"); });