nightmaregaurav.scheduler
1.0.1
See the version list below for details.
dotnet add package nightmaregaurav.scheduler --version 1.0.1
NuGet\Install-Package nightmaregaurav.scheduler -Version 1.0.1
<PackageReference Include="nightmaregaurav.scheduler" Version="1.0.1" />
paket add nightmaregaurav.scheduler --version 1.0.1
#r "nuget: nightmaregaurav.scheduler, 1.0.1"
// Install nightmaregaurav.scheduler as a Cake Addin #addin nuget:?package=nightmaregaurav.scheduler&version=1.0.1 // Install nightmaregaurav.scheduler as a Cake Tool #tool nuget:?package=nightmaregaurav.scheduler&version=1.0.1
Scheduler
Scheduler is a simple job scheduling framework in C# that allows you to easily define and execute scheduled tasks in the background. This project provides a flexible base class for creating scheduled jobs, a background service for managing job execution, a static api to register your background services dynamically, and an extension method for integrating the scheduler into your application.
Features
- Define custom scheduled jobs by extending the
ScheduledJob
base class. - Enqueue jobs for scheduling using the
ScheduleJobAsync
method. - Background service (
SchedulerService
) manages the execution of scheduled jobs. - Integration with Microsoft.Extensions.DependencyInjection for easy setup.
Getting Started
Install the Scheduler package from NuGet:
dotnet add package nightmaregaurav.scheduler
Create your scheduled job classes by extending the
ScheduledJob
base class. Implement the required methods:public class MyCustomJob : ScheduledJob { public override DateTime GetNextExecutionSchedule() { // Implement your logic to determine the next execution time. } public override Task Execute(IServiceProvider serviceProvider) { // Implement your job's logic here. } }
Add the
SchedulerService
as a hosted service in your application using the extension method:public void ConfigureServices(IServiceCollection services) { // Other service registrations... // Add the scheduler service services.StartScheduler(); }
or in your
program.cs
// Other service registrations... // Add the scheduler service builder.Services.StartScheduler();
Enqueue jobs for scheduling:
var myJob = new MyCustomJob(); await SchedulerService.ScheduleJobAsync(myJob);
Run your application, and the scheduler will automatically start executing the scheduled jobs in the background.
License
Scheduler is released under the MIT License. You can find the full license details in the LICENSE file.
Made with ❤️ by NightmareGaurav.
Open For Contribution
We welcome contributions from the community! If you find any issues or have suggestions for improvements, feel free to open a pull request or issue. Your contributions help make this project better for everyone.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- Microsoft.Extensions.Hosting.Abstractions (>= 2.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.