diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/Processor/AbpCapExpiresMessageCleanupBackgroundWorker.cs b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/Processor/AbpCapExpiresMessageCleanupBackgroundWorker.cs
deleted file mode 100644
index fac8e99a8..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/Processor/AbpCapExpiresMessageCleanupBackgroundWorker.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using DotNetCore.CAP.Persistence;
-using LINGYUN.Abp.EventBus.CAP;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using System;
-using System.Threading.Tasks;
-using Volo.Abp.BackgroundWorkers;
-using Volo.Abp.Threading;
-
-namespace DotNetCore.CAP.Processor
-{
- ///
- /// 过期消息清理任务
- ///
- public class AbpCapExpiresMessageCleanupBackgroundWorker : AsyncPeriodicBackgroundWorkerBase
- {
- ///
- /// 过期消息清理配置
- ///
- protected AbpCAPEventBusOptions Options { get; }
- ///
- /// Initializer
- ///
- protected IStorageInitializer Initializer { get; }
- ///
- /// Storage
- ///
- protected IDataStorage Storage{ get; }
- ///
- /// 创建过期消息清理任务
- ///
- ///
- ///
- ///
- ///
- ///
- public AbpCapExpiresMessageCleanupBackgroundWorker(
- AbpAsyncTimer timer,
- IDataStorage storage,
- IStorageInitializer initializer,
- IOptions options,
- IServiceScopeFactory serviceScopeFactory)
- : base(timer, serviceScopeFactory)
- {
- Storage = storage;
- Options = options.Value;
- Initializer = initializer;
-
- timer.Period = Options.CleanUpExpiresMessageInterval;
- }
-
- ///
- /// 异步执行任务
- ///
- ///
- ///
- protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
- {
- var tables = new[]
- {
- Initializer.GetPublishedTableName(),
- Initializer.GetReceivedTableName()
- };
-
- foreach (var table in tables)
- {
- Logger.LogDebug($"Collecting expired data from table: {table}");
- var time = DateTime.Now;
- await Storage.DeleteExpiresAsync(table, time, Options.CleanUpExpiresMessageBatch);
- }
- }
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/Processor/AbpCapProcessingServer.cs b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/Processor/AbpCapProcessingServer.cs
deleted file mode 100644
index 68d315b96..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/Processor/AbpCapProcessingServer.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-using DotNetCore.CAP.Internal;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace DotNetCore.CAP.Processor
-{
- ///
- /// CapProcessingServer
- ///
- public class AbpCapProcessingServer : IProcessingServer
- {
- private readonly CancellationTokenSource _cts;
- private readonly ILogger _logger;
- private readonly ILoggerFactory _loggerFactory;
- private readonly IServiceProvider _provider;
-
- private Task _compositeTask;
- private ProcessingContext _context;
- private bool _disposed;
- ///
- /// CapProcessingServer
- ///
- ///
- ///
- ///
- public AbpCapProcessingServer(
- ILogger logger,
- ILoggerFactory loggerFactory,
- IServiceProvider provider)
- {
- _logger = logger;
- _loggerFactory = loggerFactory;
- _provider = provider;
- _cts = new CancellationTokenSource();
- }
- ///
- /// Start
- ///
- public void Start(CancellationToken stoppingToken)
- {
- _logger.LogInformation("Starting the processing server.");
- stoppingToken.Register(() =>
- {
- _cts.Cancel();
- });
-
- _context = new ProcessingContext(_provider, _cts.Token);
-
- var processorTasks = GetProcessors()
- .Select(InfiniteRetry)
- .Select(p => p.ProcessAsync(_context));
- _compositeTask = Task.WhenAll(processorTasks);
- }
- ///
- /// Pulse
- ///
- public void Pulse()
- {
- _logger.LogTrace("Pulsing the processor.");
- }
- ///
- /// Dispose
- ///
- public void Dispose()
- {
- if (_disposed)
- {
- return;
- }
-
- try
- {
- _disposed = true;
-
- _logger.LogInformation("Shutting down the processing server...");
- _cts.Cancel();
-
- _compositeTask?.Wait((int)TimeSpan.FromSeconds(10).TotalMilliseconds);
- }
- catch (AggregateException ex)
- {
- var innerEx = ex.InnerExceptions[0];
- if (!(innerEx is OperationCanceledException))
- {
- _logger.LogWarning(innerEx, $"Expected an OperationCanceledException, but found '{innerEx.Message}'.");
- }
- }
- catch (Exception ex)
- {
- _logger.LogWarning(ex, "An exception was occured when disposing.");
- }
- finally
- {
- _logger.LogInformation("### CAP shutdown!");
- }
- }
-
- private IProcessor InfiniteRetry(IProcessor inner)
- {
- return new InfiniteRetryProcessor(inner, _loggerFactory);
- }
-
- private IProcessor[] GetProcessors()
- {
- var returnedProcessors = new List
- {
- _provider.GetRequiredService(),
- _provider.GetRequiredService(),
- };
-
- return returnedProcessors.ToArray();
- }
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.csproj b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.csproj
index 928fd3f6b..6973ce8fc 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.csproj
+++ b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.csproj
@@ -1,21 +1,20 @@
-
+
-
- netstandard2.1
-
- Cap分布式事件总线
- true
- $(SolutionDir)modules\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.xml
-
+
+ netstandard2.1
+
+ Cap分布式事件总线
+ true
+ $(SolutionDir)modules\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.xml
+
-
-
-
-
-
-
+
+
+
+
+
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 0f822f075..5c139a103 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
@@ -4,39 +4,39 @@
LINGYUN.Abp.EventBus.CAP
-
+
消费者查找器
-
+
CAP配置
-
+
Abp分布式事件配置
-
+
服务提供者
-
+
Creates a new .
-
+
查找消费者集合
-
+
获取事件处理器集合
@@ -44,71 +44,6 @@
-
-
- 过期消息清理任务
-
-
-
-
- 过期消息清理配置
-
-
-
-
- Initializer
-
-
-
-
- Storage
-
-
-
-
- 创建过期消息清理任务
-
-
-
-
-
-
-
-
-
- 异步执行任务
-
-
-
-
-
-
- CapProcessingServer
-
-
-
-
- CapProcessingServer
-
-
-
-
-
-
-
- Start
-
-
-
-
- Pulse
-
-
-
-
- Dispose
-
-
AbpCAPEventBusModule
@@ -120,12 +55,6 @@
-
-
- OnApplicationInitialization
-
-
-
过期消息清理配置项
@@ -137,18 +66,6 @@
default: false
-
-
- 批量清理数量
- default: 1000
-
-
-
-
- 执行间隔(ms)
- default: 3600000 (1 hours)
-
-
AbpECAPExecutionFailedException
@@ -282,12 +199,17 @@
当前客户端
+
+
+ typeof
+
+
取消令牌
-
+
constructor
@@ -297,6 +219,7 @@
+
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/ConsumerServiceSelector.cs b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPConsumerServiceSelector.cs
similarity index 95%
rename from aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/ConsumerServiceSelector.cs
rename to aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPConsumerServiceSelector.cs
index f3df9280c..712bdecb2 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/DotNetCore/CAP/ConsumerServiceSelector.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPConsumerServiceSelector.cs
@@ -1,5 +1,5 @@
-using DotNetCore.CAP.Internal;
-using LINGYUN.Abp.EventBus.CAP;
+using DotNetCore.CAP;
+using DotNetCore.CAP.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System;
@@ -10,15 +10,15 @@ using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
-namespace DotNetCore.CAP
+namespace LINGYUN.Abp.EventBus.CAP
{
///
/// 消费者查找器
///
[Dependency(ServiceLifetime.Singleton, ReplaceServices = true)]
- [ExposeServices(typeof(IConsumerServiceSelector), typeof(ConsumerServiceSelector))]
+ [ExposeServices(typeof(IConsumerServiceSelector), typeof(AbpCAPConsumerServiceSelector))]
- public class ConsumerServiceSelector : Internal.ConsumerServiceSelector
+ public class AbpCAPConsumerServiceSelector : ConsumerServiceSelector
{
///
/// CAP配置
@@ -36,7 +36,7 @@ namespace DotNetCore.CAP
///
/// Creates a new .
///
- public ConsumerServiceSelector(
+ public AbpCAPConsumerServiceSelector(
IServiceProvider serviceProvider,
IOptions capOptions,
IOptions distributedEventBusOptions) : base(serviceProvider)
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPEventBusModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPEventBusModule.cs
index ad28b0fe6..fe13cad0c 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPEventBusModule.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/AbpCAPEventBusModule.cs
@@ -1,8 +1,5 @@
-using DotNetCore.CAP.Processor;
-using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Volo.Abp;
-using Volo.Abp.BackgroundWorkers;
using Volo.Abp.EventBus;
using Volo.Abp.Modularity;
@@ -11,9 +8,7 @@ namespace LINGYUN.Abp.EventBus.CAP
///
/// AbpCAPEventBusModule
///
- [DependsOn(
- typeof(AbpEventBusModule),
- typeof(AbpBackgroundWorkersModule))]
+ [DependsOn(typeof(AbpEventBusModule))]
public class AbpCAPEventBusModule : AbpModule
{
///
@@ -30,6 +25,9 @@ namespace LINGYUN.Abp.EventBus.CAP
context.Services.AddCAPEventBus(options =>
{
+ // 取消默认的五分钟高频清理
+ // options.CollectorCleaningInterval = 360_0000;
+
configuration.GetSection("CAP:EventBus").Bind(options);
context.Services.ExecutePreConfiguredActions(options);
if (options.FailedThresholdCallback == null)
@@ -46,19 +44,5 @@ namespace LINGYUN.Abp.EventBus.CAP
}
});
}
-
- ///
- /// OnApplicationInitialization
- ///
- ///
- public override void OnApplicationInitialization(ApplicationInitializationContext context)
- {
- context.ServiceProvider
- .GetRequiredService()
- .Add(
- context.ServiceProvider
- .GetRequiredService()
- );
- }
}
}
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 e11e7b9a9..a3303f3b0 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
@@ -10,15 +10,5 @@
/// default: false
///
public bool NotifyFailedCallback { get; set; } = false;
- ///
- /// 批量清理数量
- /// default: 1000
- ///
- public int CleanUpExpiresMessageBatch { get; set; } = 1000;
- ///
- /// 执行间隔(ms)
- /// default: 3600000 (1 hours)
- ///
- public int CleanUpExpiresMessageInterval { get; set; } = 360_0000;
}
}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CAPDistributedEventBus.cs b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CAPDistributedEventBus.cs
index 1ed008cc7..c2af2ea61 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CAPDistributedEventBus.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN/Abp/EventBus/CAP/CAPDistributedEventBus.cs
@@ -5,6 +5,7 @@ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
+using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Clients;
@@ -12,6 +13,7 @@ using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Guids;
+using Volo.Abp.Json;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Threading;
using Volo.Abp.Timing;
@@ -51,10 +53,14 @@ namespace LINGYUN.Abp.EventBus.CAP
/// 当前客户端
///
protected ICurrentClient CurrentClient { get; }
- ///
- /// 取消令牌
- ///
- protected ICancellationTokenProvider CancellationTokenProvider { get; }
+ ///
+ /// typeof
+ ///
+ protected IJsonSerializer JsonSerializer { get; }
+ ///
+ /// 取消令牌
+ ///
+ protected ICancellationTokenProvider CancellationTokenProvider { get; }
///
/// constructor
///
@@ -64,6 +70,7 @@ namespace LINGYUN.Abp.EventBus.CAP
///
///
///
+ ///
///
///
///
@@ -75,6 +82,7 @@ namespace LINGYUN.Abp.EventBus.CAP
ICurrentUser currentUser,
ICurrentClient currentClient,
ICurrentTenant currentTenant,
+ IJsonSerializer jsonSerializer,
IUnitOfWorkManager unitOfWorkManager,
IGuidGenerator guidGenerator,
IClock clock,
@@ -91,6 +99,7 @@ namespace LINGYUN.Abp.EventBus.CAP
CapPublisher = capPublisher;
CurrentUser = currentUser;
CurrentClient = currentClient;
+ JsonSerializer = jsonSerializer;
CancellationTokenProvider = cancellationTokenProvider;
CustomDistributedEventSubscriber = customDistributedEventSubscriber;
HandlerFactories = new ConcurrentDictionary>();
@@ -104,9 +113,7 @@ namespace LINGYUN.Abp.EventBus.CAP
///
public override IDisposable Subscribe(Type eventType, IEventHandlerFactory factory)
{
- // 自定义的事件订阅者,可以不需要事件注册的事件类型
- CustomDistributedEventSubscriber.Subscribe(eventType, factory);
- return new DisposeAction(() => CustomDistributedEventSubscriber.UnSubscribe(eventType, factory));
+ return NullDisposable.Instance;
}
///
/// 退订事件
@@ -115,27 +122,6 @@ namespace LINGYUN.Abp.EventBus.CAP
///
public override void Unsubscribe(Func action)
{
- Check.NotNull(action, nameof(action));
-
- GetOrCreateHandlerFactories(typeof(TEvent))
- .Locking(factories =>
- {
- factories.RemoveAll(
- factory =>
- {
- if (!(factory is SingleInstanceHandlerFactory singleInstanceFactory))
- {
- return false;
- }
-
- if (!(singleInstanceFactory.HandlerInstance is ActionEventHandler actionHandler))
- {
- return false;
- }
-
- return actionHandler.Action == action;
- });
- });
}
///
/// 退订事件
@@ -144,15 +130,6 @@ namespace LINGYUN.Abp.EventBus.CAP
/// 事件处理器
public override void Unsubscribe(Type eventType, IEventHandler handler)
{
- GetOrCreateHandlerFactories(eventType)
- .Locking(factories =>
- {
- factories.RemoveAll(
- factory =>
- factory is SingleInstanceHandlerFactory &&
- (factory as SingleInstanceHandlerFactory).HandlerInstance == handler
- );
- });
}
///
/// 退订事件
@@ -161,8 +138,6 @@ namespace LINGYUN.Abp.EventBus.CAP
/// 事件处理器工厂
public override void Unsubscribe(Type eventType, IEventHandlerFactory factory)
{
- GetOrCreateHandlerFactories(eventType).Locking(factories => factories.Remove(factory));
- CustomDistributedEventSubscriber.UnSubscribe(eventType, factory);
}
///
/// 退订所有事件
@@ -170,7 +145,6 @@ namespace LINGYUN.Abp.EventBus.CAP
/// 事件类型
public override void UnsubscribeAll(Type eventType)
{
- GetOrCreateHandlerFactories(eventType).Locking(factories => factories.Clear());
}
///
/// 发布事件
@@ -181,16 +155,7 @@ namespace LINGYUN.Abp.EventBus.CAP
protected override async Task PublishToEventBusAsync(Type eventType, object eventData)
{
var eventName = EventNameAttribute.GetNameOrDefault(eventType);
- await CapPublisher
- .PublishAsync(
- eventName, eventData,
- new Dictionary
- {
- { AbpCAPHeaders.UserId, CurrentUser.Id?.ToString() ?? "" },
- { AbpCAPHeaders.ClientId, CurrentClient.Id ?? "" },
- { AbpCAPHeaders.TenantId, CurrentTenant.Id?.ToString() ?? "" },
- },
- CancellationTokenProvider.FallbackToProvider());
+ await PublishAsync(eventName, eventData);
}
///
/// 获取事件处理器工厂列表
@@ -209,19 +174,6 @@ namespace LINGYUN.Abp.EventBus.CAP
return handlerFactoryList.ToArray();
}
- private List GetOrCreateHandlerFactories(Type eventType)
- {
- return HandlerFactories.GetOrAdd(
- eventType,
- type =>
- {
- var eventName = EventNameAttribute.GetNameOrDefault(type);
- EventTypes[eventName] = type;
- return new List();
- }
- );
- }
-
private static bool ShouldTriggerEventForHandler(Type targetEventType, Type handlerEventType)
{
//Should trigger same type
@@ -240,26 +192,53 @@ namespace LINGYUN.Abp.EventBus.CAP
return false;
}
- public override Task PublishFromOutboxAsync(OutgoingEventInfo outgoingEvent, OutboxConfig outboxConfig)
+ public override async Task PublishFromOutboxAsync(OutgoingEventInfo outgoingEvent, OutboxConfig outboxConfig)
{
- // cap自行实现
- return Task.CompletedTask;
+ await PublishAsync(outgoingEvent.EventName, outgoingEvent.EventData);
}
- public override Task ProcessFromInboxAsync(IncomingEventInfo incomingEvent, InboxConfig inboxConfig)
+ public override async Task ProcessFromInboxAsync(IncomingEventInfo incomingEvent, InboxConfig inboxConfig)
{
- // cap自行实现
- return Task.CompletedTask;
+ var eventType = EventTypes.GetOrDefault(incomingEvent.EventName);
+ if (eventType == null)
+ {
+ return;
+ }
+
+ var eventJson = Encoding.UTF8.GetString(incomingEvent.EventData);
+ var eventData = JsonSerializer.Deserialize(eventType, eventJson);
+ var exceptions = new List();
+ await TriggerHandlersAsync(eventType, eventData, exceptions, inboxConfig);
+ if (exceptions.Any())
+ {
+ ThrowOriginalExceptions(eventType, exceptions);
+ }
}
protected override byte[] Serialize(object eventData)
{
- throw new NotImplementedException();
+ var eventJson = JsonSerializer.Serialize(eventData);
+
+ return Encoding.UTF8.GetBytes(eventJson);
}
protected override void AddToUnitOfWork(IUnitOfWork unitOfWork, UnitOfWorkEventRecord eventRecord)
{
unitOfWork.AddOrReplaceDistributedEvent(eventRecord);
}
+
+ protected async Task PublishAsync(string eventName, object eventData)
+ {
+ await CapPublisher
+ .PublishAsync(
+ eventName, eventData,
+ new Dictionary
+ {
+ { AbpCAPHeaders.UserId, CurrentUser.Id?.ToString() ?? "" },
+ { AbpCAPHeaders.ClientId, CurrentClient.Id ?? "" },
+ { AbpCAPHeaders.TenantId, CurrentTenant.Id?.ToString() ?? "" },
+ },
+ CancellationTokenProvider.FallbackToProvider());
+ }
}
}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs
index 9b8b488ee..136fdb0b4 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/Microsoft/Extensions/DependencyInjection/ServiceCollectionExtensions.cs
@@ -1,11 +1,8 @@
using DotNetCore.CAP;
using DotNetCore.CAP.Internal;
-using DotNetCore.CAP.Processor;
using DotNetCore.CAP.Serialization;
using LINGYUN.Abp.EventBus.CAP;
-using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
-using System.Linq;
namespace Microsoft.Extensions.DependencyInjection
{
@@ -23,16 +20,6 @@ namespace Microsoft.Extensions.DependencyInjection
public static IServiceCollection AddCAPEventBus(this IServiceCollection services, Action capAction)
{
services.AddCap(capAction);
- // 移除默认的定时清理过期消息任务
- // 默认的五分钟,不可配置,时间间隔过短,使用自定义的后台任务
- services.RemoveAll(typeof(CollectorProcessor));
- var capProcessingServiceDescriptor = services
- .FirstOrDefault(x => typeof(CapProcessingServer).Equals(x.ImplementationType));
- if(capProcessingServiceDescriptor != null)
- {
- services.Remove(capProcessingServiceDescriptor);
- }
- services.TryAddEnumerable(ServiceDescriptor.Singleton());
// 替换为自己的实现
services.AddSingleton();
services.AddSingleton();
diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.Development.json
index 909453a8c..7491b882c 100644
--- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.Development.json
@@ -31,7 +31,8 @@
"DefaultGroupName": "BackendAdmin",
"Version": "v1",
"FailedRetryInterval": 300,
- "FailedRetryCount": 10
+ "FailedRetryCount": 10,
+ "CollectorCleaningInterval": 3600000
},
"MySql": {
"TableNamePrefix": "admin",
diff --git a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.Development.json
index 5cf6b2c22..e0f8327fd 100644
--- a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.Development.json
@@ -22,7 +22,8 @@
"DefaultGroupName": "Localization-Management",
"Version": "v1",
"FailedRetryInterval": 300,
- "FailedRetryCount": 10
+ "FailedRetryCount": 10,
+ "CollectorCleaningInterval": 3600000
},
"MySql": {
"TableNamePrefix": "lta",
diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json
index 6daef1e60..090b239ce 100644
--- a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.Development.json
@@ -53,7 +53,8 @@
"DefaultGroupName": "Platform",
"Version": "v1",
"FailedRetryInterval": 300,
- "FailedRetryCount": 10
+ "FailedRetryCount": 10,
+ "CollectorCleaningInterval": 3600000
},
"MySql": {
"TableNamePrefix": "plt",
diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.Development.json
index 8cd5237a5..ae590fb5f 100644
--- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.Development.json
@@ -60,7 +60,8 @@
"DefaultGroupName": "MessageService",
"Version": "v1",
"FailedRetryInterval": 300,
- "FailedRetryCount": 10
+ "FailedRetryCount": 10,
+ "CollectorCleaningInterval": 3600000
},
"MySql": {
"TableNamePrefix": "msg",
diff --git a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/FodyWeavers.xml b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/FodyWeavers.xml
deleted file mode 100644
index 1715698cc..000000000
--- a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/FodyWeavers.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/appsettings.Development.json b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/appsettings.Development.json
index 12b6c9a93..82973b8e2 100644
--- a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/appsettings.Development.json
@@ -27,7 +27,8 @@
"DefaultGroupName": "IdentityServer4Admin",
"Version": "v1",
"FailedRetryInterval": 300,
- "FailedRetryCount": 10
+ "FailedRetryCount": 10,
+ "CollectorCleaningInterval": 3600000
},
"MySql": {
"TableNamePrefix": "ida",
diff --git a/aspnet-core/services/LY.MicroService.identityServer/appsettings.Development.json b/aspnet-core/services/LY.MicroService.identityServer/appsettings.Development.json
index ab30e9976..0f9f92842 100644
--- a/aspnet-core/services/LY.MicroService.identityServer/appsettings.Development.json
+++ b/aspnet-core/services/LY.MicroService.identityServer/appsettings.Development.json
@@ -27,7 +27,8 @@
"DefaultGroupName": "AuthServer",
"Version": "v1",
"FailedRetryInterval": 300,
- "FailedRetryCount": 10
+ "FailedRetryCount": 10,
+ "CollectorCleaningInterval": 3600000
},
"MySql": {
"TableNamePrefix": "auth",