diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/ConsumerServiceSelector.cs b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/ConsumerServiceSelector.cs
index 9e8b539f7..36117ae68 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/ConsumerServiceSelector.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/ConsumerServiceSelector.cs
@@ -20,10 +20,6 @@ namespace DotNetCore.CAP
public class ConsumerServiceSelector : Internal.ConsumerServiceSelector
{
- ///
- /// Abp Cap事件配置
- ///
- protected AbpCAPEventBusOptions AbpCAPEventBusOptions { get; }
///
/// Abp分布式事件配置
///
@@ -38,11 +34,9 @@ namespace DotNetCore.CAP
///
public ConsumerServiceSelector(
IServiceProvider serviceProvider,
- IOptions capEventBusOptions,
IOptions distributedEventBusOptions) : base(serviceProvider)
{
ServiceProvider = serviceProvider;
- AbpCAPEventBusOptions = capEventBusOptions.Value;
AbpDistributedEventBusOptions = distributedEventBusOptions.Value;
}
///
@@ -69,8 +63,21 @@ namespace DotNetCore.CAP
var genericArgs = @interface.GetGenericArguments();
if (genericArgs.Length == 1)
{
- executorDescriptorList.AddRange(
- GetHandlerDescription(genericArgs[0], handler));
+ var consumerExecutorDescriptors = GetHandlerDescription(genericArgs[0], handler);
+
+ foreach (var consumerExecutorDescriptor in consumerExecutorDescriptors)
+ {
+ if (executorDescriptorList.Any(x => new ConsumerExecutorDescriptorComparer().Equals(x, consumerExecutorDescriptor)))
+ {
+ // 如果存在多个消费者,后续的消费者需要重新定义分组才能不被 CAP 框架过滤掉
+ consumerExecutorDescriptor.Attribute.Group = handler.IsGenericType
+ ? handler.GetGenericTypeDefinition().FullName
+ : handler.FullName;
+ SetSubscribeAttribute(consumerExecutorDescriptor.Attribute);
+
+ }
+ executorDescriptorList.Add(consumerExecutorDescriptor);
+ }
//Subscribe(genericArgs[0], new IocEventHandlerFactory(ServiceScopeFactory, handler));
}
}
@@ -93,9 +100,7 @@ namespace DotNetCore.CAP
new[] { eventType }
);
// TODO: 事件名称定义在事件参数类型,就无法创建多个订阅者类了,增加可选配置,让用户决定事件名称定义在哪里
- var eventName = AbpCAPEventBusOptions.NameInEventDataType
- ? EventNameAttribute.GetNameOrDefault(eventType)
- : EventNameAttribute.GetNameOrDefault(typeInfo);
+ var eventName = EventNameAttribute.GetNameOrDefault(eventType);
var topicAttr = method.GetCustomAttributes(true);
var topicAttributes = topicAttr.ToList();
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml
index ef9cf30d9..e8a019a89 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml
+++ b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.xml
@@ -9,11 +9,6 @@
消费者查找器
-
-
- Abp Cap事件配置
-
-
Abp分布式事件配置
@@ -24,7 +19,7 @@
服务提供者
-
+
Creates a new .
@@ -137,12 +132,6 @@
default: false
-
-
- 事件名称定义在事件参数类型
- default: true
-
-
批量清理数量
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPEventBusOptions.cs b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPEventBusOptions.cs
index 36881501f..e11e7b9a9 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPEventBusOptions.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPEventBusOptions.cs
@@ -11,11 +11,6 @@
///
public bool NotifyFailedCallback { get; set; } = false;
///
- /// 事件名称定义在事件参数类型
- /// default: true
- ///
- public bool NameInEventDataType { get; set; } = true;
- ///
/// 批量清理数量
/// default: 1000
///
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CustomDistributedEventSubscriber.cs b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CustomDistributedEventSubscriber.cs
index 5684e9d68..b3f91337e 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CustomDistributedEventSubscriber.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CustomDistributedEventSubscriber.cs
@@ -17,7 +17,6 @@ namespace LINGYUN.Abp.EventBus.CAP
{
internal class CustomDistributedEventSubscriber : ICustomDistributedEventSubscriber, ISingletonDependency
{
- protected AbpCAPEventBusOptions CAPEventBusOptions { get; }
protected CapOptions CapOptions { get; }
protected IConsumerClientFactory ConsumerClientFactory { get; }
@@ -25,11 +24,9 @@ namespace LINGYUN.Abp.EventBus.CAP
protected ConcurrentDictionary EventStopingTokens { get; }
public CustomDistributedEventSubscriber(
IOptions capOptions,
- IOptions capEventBusOptions,
IConsumerClientFactory consumerClientFactory)
{
CapOptions = capOptions.Value;
- CAPEventBusOptions = capEventBusOptions.Value;
ConsumerClientFactory = consumerClientFactory;
HandlerFactories = new ConcurrentDictionary>();
@@ -84,9 +81,7 @@ namespace LINGYUN.Abp.EventBus.CAP
nameof(IDistributedEventHandler