diff --git a/Directory.Packages.props b/Directory.Packages.props
index e89f989794..428a3fa877 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -183,10 +183,10 @@
-
-
-
-
+
+
+
+
diff --git a/docs/en/framework/infrastructure/background-jobs/tickerq.md b/docs/en/framework/infrastructure/background-jobs/tickerq.md
index 013a8fde74..de7b3631f2 100644
--- a/docs/en/framework/infrastructure/background-jobs/tickerq.md
+++ b/docs/en/framework/infrastructure/background-jobs/tickerq.md
@@ -38,16 +38,19 @@ public override void ConfigureServices(ServiceConfigurationContext context)
### UseAbpTickerQ
-You need to call the `UseAbpTickerQ` extension method instead of `AddTickerQ` in the `OnApplicationInitialization` method of your module:
+You need to call the `UseAbpTickerQ` extension method in the `OnApplicationInitialization` method of your module:
```csharp
-// (default: TickerQStartMode.Immediate)
-app.UseAbpTickerQ(startMode: ...);
+public override async Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
+{
+ // (default: TickerQStartMode.Immediate)
+ context.GetHost().UseAbpTickerQ(qStartMode: ...);
+}
```
### AbpBackgroundJobsTickerQOptions
-You can configure the `TimeTicker` properties for specific jobs. For example, you can change `Priority`, `Retries` and `RetryIntervals` properties as shown below:
+You can configure the `TimeTickerEntity` properties for specific jobs. For example, you can change `Priority`, `Retries` and `RetryIntervals` properties as shown below:
```csharp
Configure(options =>
@@ -56,11 +59,10 @@ Configure(options =>
{
Retries = 3,
RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min
- Priority = TickerTaskPriority.High
+ Priority = TickerTaskPriority.High,
- // Optional batching
- //BatchParent = Guid.Parse("...."),
- //BatchRunCondition = BatchRunCondition.OnSuccess
+ // Optional: run condition for chained jobs
+ //RunCondition = RunCondition.OnSuccess
});
options.AddJobConfiguration(new AbpBackgroundJobsTimeTickerConfiguration()
@@ -74,7 +76,7 @@ Configure(options =>
### Add your own TickerQ Background Jobs Definitions
-ABP will handle the TickerQ job definitions by `AbpTickerQFunctionProvider` service. You shouldn't use `TickerFunction` to add your own job definitions. You can inject and use the `AbpTickerQFunctionProvider` to add your own definitions and use `ITimeTickerManager` or `ICronTickerManager` to manage the jobs.
+ABP will handle the TickerQ job definitions by `AbpTickerQFunctionProvider` service. You shouldn't use `TickerFunction` to add your own job definitions. You can inject and use the `AbpTickerQFunctionProvider` to add your own definitions and use `ITimeTickerManager` or `ICronTickerManager` to manage the jobs.
For example, you can add a `CleanupJobs` job definition in the `OnPreApplicationInitializationAsync` method of your module:
@@ -96,7 +98,7 @@ public override Task OnPreApplicationInitializationAsync(ApplicationInitializati
abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) =>
{
var service = new CleanupJobs(); // Or get it from the serviceProvider
- var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type);
+ var request = await TickerRequestProvider.GetRequestAsync(tickerFunctionContext, cancellationToken);
var genericContext = new TickerFunctionContext(tickerFunctionContext, request);
await service.CleanupLogsAsync(genericContext, cancellationToken);
})));
@@ -105,11 +107,11 @@ public override Task OnPreApplicationInitializationAsync(ApplicationInitializati
}
```
-And then you can add a job by using the `ITimeTickerManager`:
+And then you can add a job by using the `ITimeTickerManager`:
```csharp
-var timeTickerManager = context.ServiceProvider.GetRequiredService>();
-await timeTickerManager.AddAsync(new TimeTicker
+var timeTickerManager = context.ServiceProvider.GetRequiredService>();
+await timeTickerManager.AddAsync(new TimeTickerEntity
{
Function = nameof(CleanupJobs),
ExecutionTime = DateTime.UtcNow.AddSeconds(5),
diff --git a/docs/en/framework/infrastructure/background-workers/tickerq.md b/docs/en/framework/infrastructure/background-workers/tickerq.md
index 840b5137cb..d4ddde3cd9 100644
--- a/docs/en/framework/infrastructure/background-workers/tickerq.md
+++ b/docs/en/framework/infrastructure/background-workers/tickerq.md
@@ -36,11 +36,14 @@ public override void ConfigureServices(ServiceConfigurationContext context)
### UseAbpTickerQ
-You need to call the `UseAbpTickerQ` extension method instead of `AddTickerQ` in the `OnApplicationInitialization` method of your module:
+You need to call the `UseAbpTickerQ` extension method in the `OnApplicationInitialization` method of your module:
```csharp
-// (default: TickerQStartMode.Immediate)
-app.UseAbpTickerQ(startMode: ...);
+public override async Task OnApplicationInitializationAsync(ApplicationInitializationContext context)
+{
+ // (default: TickerQStartMode.Immediate)
+ context.GetHost().UseAbpTickerQ(qStartMode: ...);
+}
```
### AbpBackgroundWorkersTickerQOptions
@@ -61,7 +64,7 @@ Configure(options =>
### Add your own TickerQ Background Worker Definitions
-ABP will handle the TickerQ job definitions by `AbpTickerQFunctionProvider` service. You shouldn't use `TickerFunction` to add your own job definitions. You can inject and use the `AbpTickerQFunctionProvider` to add your own definitions and use `ITimeTickerManager` or `ICronTickerManager` to manage the jobs.
+ABP will handle the TickerQ job definitions by `AbpTickerQFunctionProvider` service. You shouldn't use `TickerFunction` to add your own job definitions. You can inject and use the `AbpTickerQFunctionProvider` to add your own definitions and use `ITimeTickerManager` or `ICronTickerManager` to manage the jobs.
For example, you can add a `CleanupJobs` job definition in the `OnPreApplicationInitializationAsync` method of your module:
@@ -83,7 +86,7 @@ public override Task OnPreApplicationInitializationAsync(ApplicationInitializati
abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) =>
{
var service = new CleanupJobs(); // Or get it from the serviceProvider
- var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type);
+ var request = await TickerRequestProvider.GetRequestAsync(tickerFunctionContext, cancellationToken);
var genericContext = new TickerFunctionContext(tickerFunctionContext, request);
await service.CleanupLogsAsync(genericContext, cancellationToken);
})));
@@ -92,11 +95,11 @@ public override Task OnPreApplicationInitializationAsync(ApplicationInitializati
}
```
-And then you can add a job by using the `ICronTickerManager`:
+And then you can add a job by using the `ICronTickerManager`:
```csharp
-var cronTickerManager = context.ServiceProvider.GetRequiredService>();
-await cronTickerManager.AddAsync(new CronTicker
+var cronTickerManager = context.ServiceProvider.GetRequiredService>();
+await cronTickerManager.AddAsync(new CronTickerEntity
{
Function = nameof(CleanupJobs),
Expression = "0 */6 * * *", // Every 6 hours
@@ -106,13 +109,13 @@ await cronTickerManager.AddAsync(new CronTicker
});
```
-You can specify a cron expression instead of use `ICronTickerManager` to add a worker:
+You can specify a cron expression instead of using `ICronTickerManager` to add a worker:
```csharp
abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) =>
{
var service = new CleanupJobs();
- var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type);
+ var request = await TickerRequestProvider.GetRequestAsync(tickerFunctionContext, cancellationToken);
var genericContext = new TickerFunctionContext(tickerFunctionContext, request);
await service.CleanupLogsAsync(genericContext, cancellationToken);
})));
diff --git a/docs/en/package-version-changes.md b/docs/en/package-version-changes.md
index d0f7114552..519256e0b5 100644
--- a/docs/en/package-version-changes.md
+++ b/docs/en/package-version-changes.md
@@ -1,5 +1,14 @@
# Package Version Changes
+## 10.2.0-preview
+
+| Package | Old Version | New Version | PR |
+|---------|-------------|-------------|-----|
+| TickerQ | 2.5.3 | 10.1.1 | #24916 |
+| TickerQ.Dashboard | 2.5.3 | 10.1.1 | #24916 |
+| TickerQ.EntityFrameworkCore | 2.5.3 | 10.1.1 | #24916 |
+| TickerQ.Utilities | 2.5.3 | 10.1.1 | #24916 |
+
## 10.1.0
| Package | Old Version | New Version | PR |
diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs
index 3a283cbe36..aab5b5cc2b 100644
--- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs
@@ -38,6 +38,18 @@ public static class AbpApplicationBuilderExtensions
Check.NotNull(app, nameof(app));
app.ApplicationServices.GetRequiredService>().Value = app;
+ if (app is WebApplication webApplication)
+ {
+ app.ApplicationServices.GetRequiredService>().Value = webApplication;
+ }
+ if (app is IHost host)
+ {
+ app.ApplicationServices.GetRequiredService>().Value = host;
+ }
+ if (app is IEndpointRouteBuilder endpointRouteBuilder)
+ {
+ app.ApplicationServices.GetRequiredService>().Value = endpointRouteBuilder;
+ }
var application = app.ApplicationServices.GetRequiredService();
var applicationLifetime = app.ApplicationServices.GetRequiredService();
@@ -59,6 +71,18 @@ public static class AbpApplicationBuilderExtensions
Check.NotNull(app, nameof(app));
app.ApplicationServices.GetRequiredService>().Value = app;
+ if (app is WebApplication webApplication)
+ {
+ app.ApplicationServices.GetRequiredService>().Value = webApplication;
+ }
+ if (app is IHost host)
+ {
+ app.ApplicationServices.GetRequiredService>().Value = host;
+ }
+ if (app is IEndpointRouteBuilder endpointRouteBuilder)
+ {
+ app.ApplicationServices.GetRequiredService>().Value = endpointRouteBuilder;
+ }
var application = app.ApplicationServices.GetRequiredService();
var applicationLifetime = app.ApplicationServices.GetRequiredService();
diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs
index 1e361d1587..930b081df0 100644
--- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs
@@ -1,7 +1,9 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Volo.Abp.DependencyInjection;
@@ -21,6 +23,42 @@ public static class ApplicationInitializationContextExtensions
return context.ServiceProvider.GetRequiredService>().Value;
}
+ public static IHost GetHost(this ApplicationInitializationContext context)
+ {
+ var host = context.ServiceProvider.GetRequiredService>().Value;
+ Check.NotNull(host, nameof(host));
+ return host;
+ }
+
+ public static IHost? GetHostOrNull(this ApplicationInitializationContext context)
+ {
+ return context.ServiceProvider.GetRequiredService>().Value;
+ }
+
+ public static IEndpointRouteBuilder GetEndpointRouteBuilder(this ApplicationInitializationContext context)
+ {
+ var endpointRouteBuilder = context.ServiceProvider.GetRequiredService>().Value;
+ Check.NotNull(endpointRouteBuilder, nameof(endpointRouteBuilder));
+ return endpointRouteBuilder;
+ }
+
+ public static IEndpointRouteBuilder? GetEndpointRouteBuilderOrNull(this ApplicationInitializationContext context)
+ {
+ return context.ServiceProvider.GetRequiredService>().Value;
+ }
+
+ public static WebApplication GetWebApplication(this ApplicationInitializationContext context)
+ {
+ var webApplication = context.ServiceProvider.GetRequiredService>().Value;
+ Check.NotNull(webApplication, nameof(webApplication));
+ return webApplication;
+ }
+
+ public static WebApplication? GetWebApplicationOrNull(this ApplicationInitializationContext context)
+ {
+ return context.ServiceProvider.GetRequiredService>().Value;
+ }
+
public static IWebHostEnvironment GetEnvironment(this ApplicationInitializationContext context)
{
return context.ServiceProvider.GetRequiredService();
diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs
index 405e49753c..a457d3b1eb 100644
--- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs
+++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs
@@ -2,7 +2,9 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting.StaticWebAssets;
using Microsoft.AspNetCore.RequestLocalization;
+using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.FileProviders;
using MyCSharp.HttpUserAgentParser.DependencyInjection;
using Volo.Abp.AspNetCore.Auditing;
@@ -57,6 +59,9 @@ public class AbpAspNetCoreModule : AbpModule
AddAspNetServices(context.Services);
context.Services.AddObjectAccessor();
+ context.Services.AddObjectAccessor();
+ context.Services.AddObjectAccessor();
+ context.Services.AddObjectAccessor();
context.Services.AddAbpDynamicOptions();
StaticWebAssetsLoader.UseStaticWebAssets(context.Services.GetHostingEnvironment(), context.Services.GetConfiguration());
diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo.Abp.BackgroundJobs.TickerQ.csproj b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo.Abp.BackgroundJobs.TickerQ.csproj
index df450f5ff6..41d70914a4 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo.Abp.BackgroundJobs.TickerQ.csproj
+++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo.Abp.BackgroundJobs.TickerQ.csproj
@@ -4,7 +4,7 @@
- netstandard2.1;net8.0;net9.0;net10.0
+ net10.0
enable
Nullable
Volo.Abp.BackgroundJobs.TickerQ
diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs
index b5ed598932..3d93fc68a1 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs
+++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs
@@ -65,7 +65,7 @@ public class AbpBackgroundJobsTickerQModule : AbpModule
using (var scope = serviceProvider.CreateScope())
{
var jobExecuter = serviceProvider.GetRequiredService();
- var args = await TickerRequestProvider.GetRequestAsync(serviceProvider, context.Id, context.Type);
+ var args = await TickerRequestProvider.GetRequestAsync(context, cancellationToken);
var jobType = options.GetJob(typeof(TArgs)).JobType;
var jobExecutionContext = new JobExecutionContext(scope.ServiceProvider, jobType, args!, cancellationToken: cancellationToken);
await jobExecuter.ExecuteAsync(jobExecutionContext);
diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTimeTickerConfiguration.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTimeTickerConfiguration.cs
index 65b150ea48..ecceaeb28a 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTimeTickerConfiguration.cs
+++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTimeTickerConfiguration.cs
@@ -1,4 +1,3 @@
-using System;
using TickerQ.Utilities.Enums;
namespace Volo.Abp.BackgroundJobs.TickerQ;
@@ -11,7 +10,5 @@ public class AbpBackgroundJobsTimeTickerConfiguration
public TickerTaskPriority? Priority { get; set; }
- public Guid? BatchParent { get; set; }
-
- public BatchRunCondition? BatchRunCondition { get; set; }
+ public RunCondition? RunCondition { get; set; }
}
diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpTickerQBackgroundJobManager.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpTickerQBackgroundJobManager.cs
index b1a2dbe36d..638c1845f2 100644
--- a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpTickerQBackgroundJobManager.cs
+++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpTickerQBackgroundJobManager.cs
@@ -2,8 +2,8 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using TickerQ.Utilities;
+using TickerQ.Utilities.Entities;
using TickerQ.Utilities.Interfaces.Managers;
-using TickerQ.Utilities.Models.Ticker;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.BackgroundJobs.TickerQ;
@@ -11,12 +11,12 @@ namespace Volo.Abp.BackgroundJobs.TickerQ;
[Dependency(ReplaceServices = true)]
public class AbpTickerQBackgroundJobManager : IBackgroundJobManager, ITransientDependency
{
- protected ITimeTickerManager TimeTickerManager { get; }
+ protected ITimeTickerManager TimeTickerManager { get; }
protected AbpBackgroundJobOptions Options { get; }
protected AbpBackgroundJobsTickerQOptions TickerQOptions { get; }
public AbpTickerQBackgroundJobManager(
- ITimeTickerManager timeTickerManager,
+ ITimeTickerManager timeTickerManager,
IOptions options,
IOptions tickerQOptions)
{
@@ -28,7 +28,7 @@ public class AbpTickerQBackgroundJobManager : IBackgroundJobManager, ITransientD
public virtual async Task EnqueueAsync(TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null)
{
var job = Options.GetJob(typeof(TArgs));
- var timeTicker = new TimeTicker
+ var timeTicker = new TimeTickerEntity
{
Id = Guid.NewGuid(),
Function = job.JobName,
@@ -41,11 +41,10 @@ public class AbpTickerQBackgroundJobManager : IBackgroundJobManager, ITransientD
{
timeTicker.Retries = config.Retries ?? timeTicker.Retries;
timeTicker.RetryIntervals = config.RetryIntervals ?? timeTicker.RetryIntervals;
- timeTicker.BatchParent = config.BatchParent ?? timeTicker.BatchParent;
- timeTicker.BatchRunCondition = config.BatchRunCondition ?? timeTicker.BatchRunCondition;
+ timeTicker.RunCondition = config.RunCondition ?? timeTicker.RunCondition;
}
var result = await TimeTickerManager.AddAsync(timeTicker);
- return !result.IsSucceded ? timeTicker.Id.ToString() : result.Result.Id.ToString();
+ return !result.IsSucceeded ? timeTicker.Id.ToString() : result.Result.Id.ToString();
}
}
diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo.Abp.BackgroundWorkers.TickerQ.csproj b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo.Abp.BackgroundWorkers.TickerQ.csproj
index 2c4ab29c97..b62024131d 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo.Abp.BackgroundWorkers.TickerQ.csproj
+++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo.Abp.BackgroundWorkers.TickerQ.csproj
@@ -4,7 +4,7 @@
- netstandard2.1;net8.0;net9.0;net10.0
+ net10.0
enable
Nullable
Volo.Abp.BackgroundWorkers.TickerQ
diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQModule.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQModule.cs
index 3fb15a50b8..788eee1759 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQModule.cs
+++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQModule.cs
@@ -1,8 +1,8 @@
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
+using TickerQ.Utilities.Entities;
using TickerQ.Utilities.Interfaces.Managers;
-using TickerQ.Utilities.Models.Ticker;
using Volo.Abp.Modularity;
using Volo.Abp.TickerQ;
@@ -14,11 +14,11 @@ public class AbpBackgroundWorkersTickerQModule : AbpModule
public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context)
{
var abpTickerQBackgroundWorkersProvider = context.ServiceProvider.GetRequiredService();
- var cronTickerManager = context.ServiceProvider.GetRequiredService>();
+ var cronTickerManager = context.ServiceProvider.GetRequiredService>();
var abpBackgroundWorkersTickerQOptions = context.ServiceProvider.GetRequiredService>().Value;
foreach (var backgroundWorker in abpTickerQBackgroundWorkersProvider.BackgroundWorkers)
{
- var cronTicker = new CronTicker
+ var cronTicker = new CronTickerEntity
{
Function = backgroundWorker.Value.Function,
Expression = backgroundWorker.Value.CronExpression
diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQPeriodicBackgroundWorkerInvoker.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQPeriodicBackgroundWorkerInvoker.cs
index 17cf7cdc87..f09a271017 100644
--- a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQPeriodicBackgroundWorkerInvoker.cs
+++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQPeriodicBackgroundWorkerInvoker.cs
@@ -3,7 +3,7 @@ using System.Linq.Expressions;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
-using TickerQ.Utilities.Models;
+using TickerQ.Utilities.Base;
namespace Volo.Abp.BackgroundWorkers.TickerQ;
diff --git a/framework/src/Volo.Abp.TickerQ/Microsoft/AspNetCore/Builder/AbpTickerQApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.TickerQ/Microsoft/Extensions/Hosting/AbpTickerQApplicationBuilderExtensions.cs
similarity index 61%
rename from framework/src/Volo.Abp.TickerQ/Microsoft/AspNetCore/Builder/AbpTickerQApplicationBuilderExtensions.cs
rename to framework/src/Volo.Abp.TickerQ/Microsoft/Extensions/Hosting/AbpTickerQApplicationBuilderExtensions.cs
index 4e81565e99..4d1897b200 100644
--- a/framework/src/Volo.Abp.TickerQ/Microsoft/AspNetCore/Builder/AbpTickerQApplicationBuilderExtensions.cs
+++ b/framework/src/Volo.Abp.TickerQ/Microsoft/Extensions/Hosting/AbpTickerQApplicationBuilderExtensions.cs
@@ -1,16 +1,17 @@
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
using TickerQ.DependencyInjection;
using TickerQ.Utilities;
using TickerQ.Utilities.Enums;
using Volo.Abp.TickerQ;
-namespace Microsoft.AspNetCore.Builder;
+namespace Microsoft.Extensions.Hosting;
public static class AbpTickerQApplicationBuilderExtensions
{
- public static IApplicationBuilder UseAbpTickerQ(this IApplicationBuilder app, TickerQStartMode qStartMode = TickerQStartMode.Immediate)
+ public static IHost UseAbpTickerQ(this IHost app, TickerQStartMode qStartMode = TickerQStartMode.Immediate)
{
- var abpTickerQFunctionProvider = app.ApplicationServices.GetRequiredService();
+ var abpTickerQFunctionProvider = app.Services.GetRequiredService();
TickerFunctionProvider.RegisterFunctions(abpTickerQFunctionProvider.Functions);
TickerFunctionProvider.RegisterRequestType(abpTickerQFunctionProvider.RequestTypes);
diff --git a/framework/src/Volo.Abp.TickerQ/Volo.Abp.TickerQ.csproj b/framework/src/Volo.Abp.TickerQ/Volo.Abp.TickerQ.csproj
index 89a037bab7..51649a9a86 100644
--- a/framework/src/Volo.Abp.TickerQ/Volo.Abp.TickerQ.csproj
+++ b/framework/src/Volo.Abp.TickerQ/Volo.Abp.TickerQ.csproj
@@ -4,7 +4,7 @@
- netstandard2.1;net8.0;net9.0;net10.0
+ net10.0
enable
Nullable
Volo.Abp.TickerQ
diff --git a/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQModule.cs b/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQModule.cs
index b6c140e962..82b47294e1 100644
--- a/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQModule.cs
+++ b/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQModule.cs
@@ -10,7 +10,10 @@ public class AbpTickerQModule : AbpModule
{
context.Services.AddTickerQ(options =>
{
- options.SetInstanceIdentifier(context.Services.GetApplicationName());
+ options.ConfigureScheduler(scheduler =>
+ {
+ scheduler.NodeIdentifier = context.Services.GetApplicationName();
+ });
});
}
}
diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/CleanupJobs.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/CleanupJobs.cs
index 6eca55e09f..3b9da774ae 100644
--- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/CleanupJobs.cs
+++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/CleanupJobs.cs
@@ -1,7 +1,7 @@
using System;
using System.Threading;
using System.Threading.Tasks;
-using TickerQ.Utilities.Models;
+using TickerQ.Utilities.Base;
namespace Volo.Abp.BackgroundJobs.DemoApp.TickerQ;
diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/DemoAppTickerQModule.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/DemoAppTickerQModule.cs
index c9a3b957de..de3ef3c05d 100644
--- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/DemoAppTickerQModule.cs
+++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/DemoAppTickerQModule.cs
@@ -3,13 +3,14 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
using TickerQ.Dashboard.DependencyInjection;
using TickerQ.DependencyInjection;
using TickerQ.Utilities;
using TickerQ.Utilities.Enums;
using TickerQ.Utilities.Interfaces.Managers;
-using TickerQ.Utilities.Models;
-using TickerQ.Utilities.Models.Ticker;
+using TickerQ.Utilities.Base;
+using TickerQ.Utilities.Entities;
using Volo.Abp.AspNetCore;
using Volo.Abp.Autofac;
using Volo.Abp.BackgroundJobs.DemoApp.Shared;
@@ -35,13 +36,14 @@ public class DemoAppTickerQModule : AbpModule
{
context.Services.AddTickerQ(options =>
{
- options.UpdateMissedJobCheckDelay(TimeSpan.FromSeconds(30));
+ options.ConfigureScheduler(scheduler =>
+ {
+ scheduler.FallbackIntervalChecker = TimeSpan.FromSeconds(30);
+ });
options.AddDashboard(x =>
{
- x.BasePath = "/tickerq-dashboard";
-
- x.UseHostAuthentication = true;
+ x.SetBasePath("/tickerq-dashboard");
});
});
@@ -78,7 +80,7 @@ public class DemoAppTickerQModule : AbpModule
abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) =>
{
var service = new CleanupJobs();
- var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type);
+ var request = await TickerRequestProvider.GetRequestAsync(tickerFunctionContext, cancellationToken);
var genericContext = new TickerFunctionContext(tickerFunctionContext, request);
await service.CleanupLogsAsync(genericContext, cancellationToken);
})));
@@ -92,10 +94,11 @@ public class DemoAppTickerQModule : AbpModule
await backgroundWorkerManager.AddAsync(context.ServiceProvider.GetRequiredService());
var app = context.GetApplicationBuilder();
- app.UseAbpTickerQ();
- var timeTickerManager = context.ServiceProvider.GetRequiredService>();
- await timeTickerManager.AddAsync(new TimeTicker
+ context.GetHost().UseAbpTickerQ();
+
+ var timeTickerManager = context.ServiceProvider.GetRequiredService>();
+ await timeTickerManager.AddAsync(new TimeTickerEntity
{
Function = nameof(CleanupJobs),
ExecutionTime = DateTime.UtcNow.AddSeconds(5),
@@ -104,8 +107,8 @@ public class DemoAppTickerQModule : AbpModule
RetryIntervals = new[] { 30, 60, 120 }, // Retry after 30s, 60s, then 2min
});
- var cronTickerManager = context.ServiceProvider.GetRequiredService>();
- await cronTickerManager.AddAsync(new CronTicker
+ var cronTickerManager = context.ServiceProvider.GetRequiredService>();
+ await cronTickerManager.AddAsync(new CronTickerEntity
{
Function = nameof(CleanupJobs),
Expression = "* * * * *", // Every minute
@@ -134,7 +137,7 @@ public class DemoAppTickerQModule : AbpModule
await Task.Delay(1000);
- var timeTickerManager = serviceProvider.GetRequiredService>();
+ var timeTickerManager = serviceProvider.GetRequiredService>();
var result = await timeTickerManager.DeleteAsync(Guid.Parse(jobId));
}
}