EonaCat.JobScheduler
1.0.0
Prefix Reserved
dotnet add package EonaCat.JobScheduler --version 1.0.0
NuGet\Install-Package EonaCat.JobScheduler -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EonaCat.JobScheduler" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EonaCat.JobScheduler" Version="1.0.0" />
<PackageReference Include="EonaCat.JobScheduler" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EonaCat.JobScheduler --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EonaCat.JobScheduler, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EonaCat.JobScheduler@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EonaCat.JobScheduler&version=1.0.0
#tool nuget:?package=EonaCat.JobScheduler&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EonaCat.JobScheduler
Schedule Jobs to execute using EonaCat.JobScheduler.
Jobs example:
public class EmailJob : IJob
{
public string Id { get; } = Guid.NewGuid().ToString();
public string Name { get; } = "Email Job";
public string To { get; set; }
public string Subject { get; set; }
public string Body { get; set; }
public async Task ExecuteAsync(CancellationToken cancellationToken = default)
{
// Simulate sending email
await Task.Delay(2000, cancellationToken);
Console.WriteLine($"Email sent to {To}: {Subject}");
}
}
public class DataBackupJob : IJob
{
public string Id { get; } = Guid.NewGuid().ToString();
public string Name { get; } = "Data Backup Job";
public string BackupPath { get; set; }
public async Task ExecuteAsync(CancellationToken cancellationToken = default)
{
// Simulate backup process
await Task.Delay(5000, cancellationToken);
Console.WriteLine($"Data backup completed to {BackupPath}");
}
}
Usage example:
public static class SchedulerExample
{
public static async Task Example()
{
var scheduler = new JobScheduler();
// Subscribe to events
scheduler.JobCompleted += (s, e) =>
Console.WriteLine($"Job {e.JobName} completed in {e.Duration}");
scheduler.JobFailed += (s, e) =>
Console.WriteLine($"Job {e.JobName} failed: {e.ErrorMessage}");
// Schedule immediate job
await scheduler.RunJobNowAsync<EmailJob>("Welcome Email", new Dictionary<string, object>
{
["To"] = "user@example.com",
["Subject"] = "Welcome!",
["Body"] = "Welcome to our service!"
});
// Schedule recurring backup job (daily at 2 AM)
await scheduler.ScheduleRecurringJobAsync<DataBackupJob>(
"Daily Backup",
"0 0 2 * * *",
new Dictionary<string, object>
{
["BackupPath"] = "/backups/daily"
});
// Schedule one-time job for later
var jobDef = JobDefinition.Create<EmailJob>("Reminder Email")
.ScheduleAt(DateTime.UtcNow.AddHours(24))
.WithPriority(JobPriority.High)
.WithRetry(new RetryPolicy { MaxAttempts = 5 })
.WithTimeout(TimeSpan.FromMinutes(5))
.WithParameter("To", "admin@example.com")
.WithParameter("Subject", "Daily Report")
.WithParameter("Body", "Please review the daily report.");
await scheduler.ScheduleJobAsync(jobDef);
Console.WriteLine("Jobs scheduled. Press any key to exit...");
Console.ReadKey();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 144 | 6/29/2025 |