diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln
index 1b5c47329f..f3e495c814 100644
--- a/framework/Volo.Abp.sln
+++ b/framework/Volo.Abp.sln
@@ -391,8 +391,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.IdentityModel.Test
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Threading.Tests", "test\Volo.Abp.Threading.Tests\Volo.Abp.Threading.Tests.csproj", "{7B2FCAD6-86E6-49C8-ADBE-A61B4F4B101B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.EventBus.Boxes", "src\Volo.Abp.EventBus.Boxes\Volo.Abp.EventBus.Boxes.csproj", "{6E289F31-7924-418B-9DAC-62A7CFADF916}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.DistributedLocking", "src\Volo.Abp.DistributedLocking\Volo.Abp.DistributedLocking.csproj", "{9A7EEA08-15BE-476D-8168-53039867038E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Auditing.Contracts", "src\Volo.Abp.Auditing.Contracts\Volo.Abp.Auditing.Contracts.csproj", "{508B6355-AD28-4E60-8549-266D21DBF2CF}"
@@ -1179,10 +1177,6 @@ Global
{7B2FCAD6-86E6-49C8-ADBE-A61B4F4B101B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B2FCAD6-86E6-49C8-ADBE-A61B4F4B101B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B2FCAD6-86E6-49C8-ADBE-A61B4F4B101B}.Release|Any CPU.Build.0 = Release|Any CPU
- {6E289F31-7924-418B-9DAC-62A7CFADF916}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6E289F31-7924-418B-9DAC-62A7CFADF916}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6E289F31-7924-418B-9DAC-62A7CFADF916}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6E289F31-7924-418B-9DAC-62A7CFADF916}.Release|Any CPU.Build.0 = Release|Any CPU
{9A7EEA08-15BE-476D-8168-53039867038E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A7EEA08-15BE-476D-8168-53039867038E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A7EEA08-15BE-476D-8168-53039867038E}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1404,7 +1398,6 @@ Global
{90B1866A-EF99-40B9-970E-B898E5AA523F} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{40C6740E-BFCA-4D37-8344-3D84E2044BB2} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{7B2FCAD6-86E6-49C8-ADBE-A61B4F4B101B} = {447C8A77-E5F0-4538-8687-7383196D04EA}
- {6E289F31-7924-418B-9DAC-62A7CFADF916} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{9A7EEA08-15BE-476D-8168-53039867038E} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{508B6355-AD28-4E60-8549-266D21DBF2CF} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{F7407459-8AFA-45E4-83E9-9BB01412CC08} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
diff --git a/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj b/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj
index 858038e5df..7d4f2d9fa2 100644
--- a/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj
+++ b/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/AbpBackgroundJobsModule.cs b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/AbpBackgroundJobsModule.cs
index dccf2006dc..f5be42a2d6 100644
--- a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/AbpBackgroundJobsModule.cs
+++ b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/AbpBackgroundJobsModule.cs
@@ -1,6 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp.BackgroundWorkers;
+using Volo.Abp.DistributedLocking;
using Volo.Abp.Guids;
using Volo.Abp.Modularity;
using Volo.Abp.Timing;
@@ -11,7 +12,8 @@ namespace Volo.Abp.BackgroundJobs
typeof(AbpBackgroundJobsAbstractionsModule),
typeof(AbpBackgroundWorkersModule),
typeof(AbpTimingModule),
- typeof(AbpGuidsModule)
+ typeof(AbpGuidsModule),
+ typeof(AbpDistributedLockingAbstractionsModule)
)]
public class AbpBackgroundJobsModule : AbpModule
{
diff --git a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs
index 8eec35d816..836b3881bb 100644
--- a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs
+++ b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs
@@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Volo.Abp.BackgroundWorkers;
+using Volo.Abp.DistributedLocking;
using Volo.Abp.Threading;
using Volo.Abp.Timing;
@@ -16,15 +17,19 @@ namespace Volo.Abp.BackgroundJobs
protected AbpBackgroundJobWorkerOptions WorkerOptions { get; }
+ protected IAbpDistributedLock DistributedLock { get; }
+
public BackgroundJobWorker(
AbpAsyncTimer timer,
IOptions jobOptions,
IOptions workerOptions,
- IServiceScopeFactory serviceScopeFactory)
+ IServiceScopeFactory serviceScopeFactory,
+ IAbpDistributedLock distributedLock)
: base(
timer,
serviceScopeFactory)
{
+ DistributedLock = distributedLock;
WorkerOptions = workerOptions.Value;
JobOptions = jobOptions.Value;
Timer.Period = WorkerOptions.JobPollPeriod;
@@ -32,57 +37,74 @@ namespace Volo.Abp.BackgroundJobs
protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext)
{
- var store = workerContext.ServiceProvider.GetRequiredService();
-
- var waitingJobs = await store.GetWaitingJobsAsync(WorkerOptions.MaxJobFetchCount);
-
- if (!waitingJobs.Any())
+ await using (var handler = await DistributedLock.TryAcquireAsync(""))
{
- return;
- }
-
- var jobExecuter = workerContext.ServiceProvider.GetRequiredService();
- var clock = workerContext.ServiceProvider.GetRequiredService();
- var serializer = workerContext.ServiceProvider.GetRequiredService();
-
- foreach (var jobInfo in waitingJobs)
- {
- jobInfo.TryCount++;
- jobInfo.LastTryTime = clock.Now;
-
- try
+ if (handler != null)
{
- var jobConfiguration = JobOptions.GetJob(jobInfo.JobName);
- var jobArgs = serializer.Deserialize(jobInfo.JobArgs, jobConfiguration.ArgsType);
- var context = new JobExecutionContext(workerContext.ServiceProvider, jobConfiguration.JobType, jobArgs);
+ var store = workerContext.ServiceProvider.GetRequiredService();
- try
- {
- await jobExecuter.ExecuteAsync(context);
+ var waitingJobs = await store.GetWaitingJobsAsync(WorkerOptions.MaxJobFetchCount);
- await store.DeleteAsync(jobInfo.Id);
+ if (!waitingJobs.Any())
+ {
+ return;
}
- catch (BackgroundJobExecutionException)
+
+ var jobExecuter = workerContext.ServiceProvider.GetRequiredService();
+ var clock = workerContext.ServiceProvider.GetRequiredService();
+ var serializer = workerContext.ServiceProvider.GetRequiredService();
+
+ foreach (var jobInfo in waitingJobs)
{
- var nextTryTime = CalculateNextTryTime(jobInfo, clock);
+ jobInfo.TryCount++;
+ jobInfo.LastTryTime = clock.Now;
- if (nextTryTime.HasValue)
+ try
{
- jobInfo.NextTryTime = nextTryTime.Value;
+ var jobConfiguration = JobOptions.GetJob(jobInfo.JobName);
+ var jobArgs = serializer.Deserialize(jobInfo.JobArgs, jobConfiguration.ArgsType);
+ var context = new JobExecutionContext(
+ workerContext.ServiceProvider,
+ jobConfiguration.JobType,
+ jobArgs);
+
+ try
+ {
+ await jobExecuter.ExecuteAsync(context);
+
+ await store.DeleteAsync(jobInfo.Id);
+ }
+ catch (BackgroundJobExecutionException)
+ {
+ var nextTryTime = CalculateNextTryTime(jobInfo, clock);
+
+ if (nextTryTime.HasValue)
+ {
+ jobInfo.NextTryTime = nextTryTime.Value;
+ }
+ else
+ {
+ jobInfo.IsAbandoned = true;
+ }
+
+ await TryUpdateAsync(store, jobInfo);
+ }
}
- else
+ catch (Exception ex)
{
+ Logger.LogException(ex);
jobInfo.IsAbandoned = true;
+ await TryUpdateAsync(store, jobInfo);
}
-
- await TryUpdateAsync(store, jobInfo);
}
}
- catch (Exception ex)
+ else
{
- Logger.LogException(ex);
- jobInfo.IsAbandoned = true;
- await TryUpdateAsync(store, jobInfo);
+ try
+ {
+ await Task.Delay(WorkerOptions.JobPollPeriod * 12, StoppingToken);
+ }
+ catch (TaskCanceledException) { }
}
}
}
@@ -101,7 +123,8 @@ namespace Volo.Abp.BackgroundJobs
protected virtual DateTime? CalculateNextTryTime(BackgroundJobInfo jobInfo, IClock clock)
{
- var nextWaitDuration = WorkerOptions.DefaultFirstWaitDuration * (Math.Pow(WorkerOptions.DefaultWaitFactor, jobInfo.TryCount - 1));
+ var nextWaitDuration = WorkerOptions.DefaultFirstWaitDuration *
+ (Math.Pow(WorkerOptions.DefaultWaitFactor, jobInfo.TryCount - 1));
var nextTryDate = jobInfo.LastTryTime?.AddSeconds(nextWaitDuration) ??
clock.Now.AddSeconds(nextWaitDuration);
@@ -113,4 +136,4 @@ namespace Volo.Abp.BackgroundJobs
return nextTryDate;
}
}
-}
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerBase.cs
index 85523d7ee9..c497555be9 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerBase.cs
+++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerBase.cs
@@ -21,6 +21,15 @@ namespace Volo.Abp.BackgroundWorkers
protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService();
protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance);
+
+ protected CancellationTokenSource StoppingTokenSource { get; }
+ protected CancellationToken StoppingToken { get; }
+
+ public BackgroundWorkerBase()
+ {
+ StoppingTokenSource = new CancellationTokenSource();
+ StoppingToken = StoppingTokenSource.Token;
+ }
public virtual Task StartAsync(CancellationToken cancellationToken = default)
{
@@ -31,6 +40,8 @@ namespace Volo.Abp.BackgroundWorkers
public virtual Task StopAsync(CancellationToken cancellationToken = default)
{
Logger.LogDebug("Stopped background worker: " + ToString());
+ StoppingTokenSource.Cancel();
+ StoppingTokenSource.Dispose();
return Task.CompletedTask;
}
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj
index 68c90489ff..87879334af 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj.DotSettings b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj.DotSettings
deleted file mode 100644
index 58ad6c8854..0000000000
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj.DotSettings
+++ /dev/null
@@ -1,2 +0,0 @@
-
- CSharp71
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs
index 38e2d9fc84..523a6ee4f2 100644
--- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs
+++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/AbpDddDomainModule.cs
@@ -3,7 +3,6 @@ using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.EventBus;
-using Volo.Abp.EventBus.Boxes;
using Volo.Abp.ExceptionHandling;
using Volo.Abp.Guids;
using Volo.Abp.Modularity;
@@ -19,7 +18,7 @@ namespace Volo.Abp.Domain
[DependsOn(
typeof(AbpAuditingModule),
typeof(AbpDataModule),
- typeof(AbpEventBusBoxesModule),
+ typeof(AbpEventBusModule),
typeof(AbpGuidsModule),
typeof(AbpMultiTenancyModule),
typeof(AbpThreadingModule),
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/FodyWeavers.xml b/framework/src/Volo.Abp.EventBus.Boxes/FodyWeavers.xml
deleted file mode 100644
index 1715698ccd..0000000000
--- a/framework/src/Volo.Abp.EventBus.Boxes/FodyWeavers.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/FodyWeavers.xsd b/framework/src/Volo.Abp.EventBus.Boxes/FodyWeavers.xsd
deleted file mode 100644
index ffa6fc4b78..0000000000
--- a/framework/src/Volo.Abp.EventBus.Boxes/FodyWeavers.xsd
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.
-
-
-
-
- A comma-separated list of error codes that can be safely ignored in assembly verification.
-
-
-
-
- 'false' to turn off automatic generation of the XML Schema file.
-
-
-
-
-
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo.Abp.EventBus.Boxes.csproj b/framework/src/Volo.Abp.EventBus.Boxes/Volo.Abp.EventBus.Boxes.csproj
deleted file mode 100644
index 6cbaf62aed..0000000000
--- a/framework/src/Volo.Abp.EventBus.Boxes/Volo.Abp.EventBus.Boxes.csproj
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
- netstandard2.0
- Volo.Abp.EventBus.Boxes
- Volo.Abp.EventBus.Boxes
- $(AssetTargetFallback);portable-net45+win8+wp8+wpa81;
- false
- false
- false
-
-
-
-
-
-
-
-
-
-
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/AbpEventBusBoxesModule.cs b/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/AbpEventBusBoxesModule.cs
deleted file mode 100644
index 0c7a2c4247..0000000000
--- a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/AbpEventBusBoxesModule.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Volo.Abp.BackgroundWorkers;
-using Volo.Abp.DistributedLocking;
-using Volo.Abp.Modularity;
-
-namespace Volo.Abp.EventBus.Boxes
-{
- [DependsOn(
- typeof(AbpEventBusModule),
- typeof(AbpBackgroundWorkersModule),
- typeof(AbpDistributedLockingModule)
- )]
- public class AbpEventBusBoxesModule : AbpModule
- {
- public override void OnApplicationInitialization(ApplicationInitializationContext context)
- {
- context.AddBackgroundWorker();
- context.AddBackgroundWorker();
- }
- }
-}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/TaskHelper.cs b/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/TaskHelper.cs
deleted file mode 100644
index 87abe18da8..0000000000
--- a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/TaskHelper.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Volo.Abp.EventBus.Boxes
-{
- internal static class TaskDelayHelper
- {
- public static async Task DelayAsync(int milliseconds, CancellationToken cancellationToken = default)
- {
- try
- {
- await Task.Delay(milliseconds, cancellationToken);
- }
- catch (TaskCanceledException)
- {
- return;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj b/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj
index 5de5b0893f..bee75bf7ff 100644
--- a/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj
+++ b/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj
@@ -15,6 +15,8 @@
+
+
diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs
index 3bbdf3d72b..58280c7066 100644
--- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs
+++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/AbpEventBusModule.cs
@@ -1,7 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
+using Volo.Abp.BackgroundWorkers;
+using Volo.Abp.DistributedLocking;
using Volo.Abp.EventBus.Abstractions;
+using Volo.Abp.EventBus.Boxes;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.EventBus.Local;
using Volo.Abp.Guids;
@@ -16,7 +19,9 @@ namespace Volo.Abp.EventBus
typeof(AbpEventBusAbstractionsModule),
typeof(AbpMultiTenancyModule),
typeof(AbpJsonModule),
- typeof(AbpGuidsModule)
+ typeof(AbpGuidsModule),
+ typeof(AbpBackgroundWorkersModule),
+ typeof(AbpDistributedLockingAbstractionsModule)
)]
public class AbpEventBusModule : AbpModule
{
@@ -24,6 +29,12 @@ namespace Volo.Abp.EventBus
{
AddEventHandlers(context.Services);
}
+
+ public override void OnApplicationInitialization(ApplicationInitializationContext context)
+ {
+ context.AddBackgroundWorker();
+ context.AddBackgroundWorker();
+ }
private static void AddEventHandlers(IServiceCollection services)
{
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/AbpDistributedEventBusExtensions.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/AbpDistributedEventBusExtensions.cs
similarity index 100%
rename from framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/AbpDistributedEventBusExtensions.cs
rename to framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/AbpDistributedEventBusExtensions.cs
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/AbpEventBusBoxesOptions.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/AbpEventBusBoxesOptions.cs
similarity index 100%
rename from framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/AbpEventBusBoxesOptions.cs
rename to framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/AbpEventBusBoxesOptions.cs
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/IInboxProcessor.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IInboxProcessor.cs
similarity index 100%
rename from framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/IInboxProcessor.cs
rename to framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IInboxProcessor.cs
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/IOutboxSender.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IOutboxSender.cs
similarity index 100%
rename from framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/IOutboxSender.cs
rename to framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/IOutboxSender.cs
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/InboxProcessManager.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/InboxProcessManager.cs
similarity index 100%
rename from framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/InboxProcessManager.cs
rename to framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/InboxProcessManager.cs
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/InboxProcessor.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/InboxProcessor.cs
similarity index 95%
rename from framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/InboxProcessor.cs
rename to framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/InboxProcessor.cs
index 4d071485cc..54a7cf2746 100644
--- a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/InboxProcessor.cs
+++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/InboxProcessor.cs
@@ -120,9 +120,11 @@ namespace Volo.Abp.EventBus.Boxes
else
{
Logger.LogDebug("Could not obtain the distributed lock: " + DistributedLockName);
- await TaskDelayHelper.DelayAsync(
- Convert.ToInt32(EventBusBoxesOptions.DistributedLockWaitDuration.TotalMilliseconds),
- StoppingToken);
+ try
+ {
+ await Task.Delay(EventBusBoxesOptions.DistributedLockWaitDuration, StoppingToken);
+ }
+ catch (TaskCanceledException) { }
}
}
}
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/OutboxSender.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutboxSender.cs
similarity index 94%
rename from framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/OutboxSender.cs
rename to framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutboxSender.cs
index eb82b3cf18..33fcd4caa7 100644
--- a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/OutboxSender.cs
+++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutboxSender.cs
@@ -100,9 +100,11 @@ namespace Volo.Abp.EventBus.Boxes
else
{
Logger.LogDebug("Could not obtain the distributed lock: " + DistributedLockName);
- await TaskDelayHelper.DelayAsync(
- Convert.ToInt32(EventBusBoxesOptions.DistributedLockWaitDuration.TotalMilliseconds),
- StoppingToken);
+ try
+ {
+ await Task.Delay(EventBusBoxesOptions.DistributedLockWaitDuration, StoppingToken);
+ }
+ catch (TaskCanceledException) { }
}
}
}
diff --git a/framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/OutboxSenderManager.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutboxSenderManager.cs
similarity index 100%
rename from framework/src/Volo.Abp.EventBus.Boxes/Volo/Abp/EventBus/Boxes/OutboxSenderManager.cs
rename to framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/OutboxSenderManager.cs
diff --git a/nupkg/common.ps1 b/nupkg/common.ps1
index 06e9697f54..75a8b0c9c0 100644
--- a/nupkg/common.ps1
+++ b/nupkg/common.ps1
@@ -105,7 +105,6 @@ $projects = (
"framework/src/Volo.Abp.EntityFrameworkCore.SqlServer",
"framework/src/Volo.Abp.EventBus.Abstractions",
"framework/src/Volo.Abp.EventBus",
- "framework/src/Volo.Abp.EventBus.Boxes",
"framework/src/Volo.Abp.EventBus.RabbitMQ",
"framework/src/Volo.Abp.EventBus.Kafka",
"framework/src/Volo.Abp.EventBus.Rebus",