Browse Source

Merge pull request #12671 from abpframework/auto-merge/rel-5-2/1083

Merge branch rel-5.3 with rel-5.2
pull/12672/head
maliming 4 years ago
committed by GitHub
parent
commit
c3f2d4423d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpRebusEventHandlerStep.cs
  2. 6
      framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/IRebusDistributedEventHandlerAdapter.cs
  3. 2
      framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventHandlerAdapter.cs

10
framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpRebusEventHandlerStep.cs

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Rebus.Messages;
@ -14,9 +15,12 @@ public class AbpRebusEventHandlerStep : IIncomingStep
var message = context.Load<Message>();
var handlerInvokers = context.Load<HandlerInvokers>().ToList();
handlerInvokers.RemoveAll(x => x.Handler.GetType() == typeof(RebusDistributedEventHandlerAdapter<object>));
context.Save(new HandlerInvokers(message, handlerInvokers));
if (handlerInvokers.All(x => x.Handler is IRebusDistributedEventHandlerAdapter))
{
handlerInvokers = new List<HandlerInvoker> {handlerInvokers.Last()};
context.Save(new HandlerInvokers(message, handlerInvokers));
}
return next();
}
}

6
framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/IRebusDistributedEventHandlerAdapter.cs

@ -0,0 +1,6 @@
namespace Volo.Abp.EventBus.Rebus;
public interface IRebusDistributedEventHandlerAdapter
{
}

2
framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventHandlerAdapter.cs

@ -3,7 +3,7 @@ using Rebus.Handlers;
namespace Volo.Abp.EventBus.Rebus;
public class RebusDistributedEventHandlerAdapter<TEventData> : IHandleMessages<TEventData>
public class RebusDistributedEventHandlerAdapter<TEventData> : IHandleMessages<TEventData> , IRebusDistributedEventHandlerAdapter
{
protected RebusDistributedEventBus RebusDistributedEventBus { get; }

Loading…
Cancel
Save