Com.H.Threading.Scheduler 10.0.1

dotnet add package Com.H.Threading.Scheduler --version 10.0.1
                    
NuGet\Install-Package Com.H.Threading.Scheduler -Version 10.0.1
                    
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="Com.H.Threading.Scheduler" Version="10.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Com.H.Threading.Scheduler" Version="10.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Com.H.Threading.Scheduler" />
                    
Project file
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 Com.H.Threading.Scheduler --version 10.0.1
                    
#r "nuget: Com.H.Threading.Scheduler, 10.0.1"
                    
#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 Com.H.Threading.Scheduler@10.0.1
                    
#: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=Com.H.Threading.Scheduler&version=10.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Com.H.Threading.Scheduler&version=10.0.1
                    
Install as a Cake Tool

Com.H.Threading.Scheduler

For full documentation, visit the GitHub project page.

An easy-to-use, feature-rich, open-source scheduling framework for building background services as Windows services, Linux daemons, or containerized microservices.

Quick start

Define tasks in an XML configuration file with scheduling rules in <sys> and custom data in any other tags:

scheduler.xml

<?xml version="1.0" encoding="utf-8" ?>
<tasks_list>
  <task>
    <sys>
      <time>11:00</time>
    </sys>
    <greeting_message>Good morning! It's 11:00 AM!</greeting_message>
  </task>
</tasks_list>

Program.cs

using Com.H.Threading.Scheduler;

var configPath = Path.Combine(AppContext.BaseDirectory, "scheduler.xml");
if (!File.Exists(configPath)) throw new FileNotFoundException(configPath);

var scheduler = new HTaskScheduler(configPath);
scheduler.TaskIsDue += async (object sender, HTaskEventArgs e, CancellationToken ct) =>
{
    Console.WriteLine(e["greeting_message"]);
};

Console.WriteLine("Press <ctrl+c> to exit.");
await scheduler.StartAsync();

Interval scheduling

Run every 3 seconds between 9:00 AM and 2:00 PM on specific days:

<sys>
  <time>09:00</time>
  <until_time>14:00</until_time>
  <interval>3000</interval>
  <dow>Monday,Thursday</dow>
</sys>

Scheduling rules

All rules compose — every condition must be true for a task to run.

Tag Description Format Example
enabled Enable or disable the task true / false true
not_before Earliest date/time to run yyyy-MM-dd HH:mm:ss 2026-06-01 08:00:00
not_after Latest date/time to run yyyy-MM-dd HH:mm:ss 2026-12-31 23:59:59
dates Specific dates (pipe-delimited) yyyy-MM-dd 2026-01-15\|\|2026-07-04
doy Days of the year Integer 1–366 1,60,120..130
eom Last day of month true / false true
bom First day of month true / false true
dom Days of the month Integer 1–31 1,15,28..31
dow Days of the week Weekday names Monday,Friday
time Start time HH:mm 14:30
until_time End time HH:mm 23:00
interval Milliseconds between runs Positive integer 5000
ignore_log_on_restart Force re-run on restart true / false true

Retry on error

<sys>
  <interval>10000</interval>
  <retry_attempts_on_error>3</retry_attempts_on_error>
  <sleep_on_error>5000</sleep_on_error>
</sys>

Variables

Built-in placeholders replaced at runtime:

Variable Example Result
{now{yyyy-MM-dd}} {now{yyyy-MM-dd}} 2026-04-15
{tomorrow{yyyy-MM-dd}} {tomorrow{yyyy-MM-dd}} 2026-04-16
{dir{sys}} {dir{sys}}\data C:\app\bin\data
{dir{uri}} {dir{uri}}/data file:///C:/app/bin/data

Repeat

Execute a task multiple times with different data per iteration. Supports XML (default), JSON, CSV, and pipe-separated formats:

<sys>
  <interval>60000</interval>
  <repeat content_type="json" delay_interval="500">
    [
      {"id": 1, "name": "alice"},
      {"id": 2, "name": "bob"}
    ]
  </repeat>
</sys>
<message>Processing {var{name}} (ID: {var{id}})</message>

Repeat from external source

Chain content types to fetch and parse: uri > json, uri > csv, uri > xml, etc.

<repeat content_type="uri > json" delay_interval="500">
  https://api.example.com/users
</repeat>

File URIs are also supported:

<repeat content_type="uri > csv" delay_interval="500">
  {dir{uri}}/data/users.csv
</repeat>

External settings

Fetch tag content from URLs with optional caching:

<config content_type="uri" content_cache="once_per_day">
  https://api.example.com/config
</config>

Cache options: none (default), once_per_day / daily, or milliseconds (e.g., 3600000).

Dynamic scheduling with URI — skip holidays

content_type="uri" also works on scheduling rules inside <sys>. Point <enabled> at an API — if the response contains true (case-insensitive), the task runs; otherwise it's skipped:

<sys>
  <time>09:00</time>
  <dow>Monday,Tuesday,Wednesday,Thursday,Friday</dow>
  <enabled content_type="uri">https://api.example.com/is-business-day?date={now{yyyy-MM-dd}}</enabled>
</sys>

Add content_cache="once_per_day" to avoid calling the API on every tick — the result is cached until midnight:

<enabled content_type="uri" content_cache="once_per_day">https://api.example.com/is-business-day?date={now{yyyy-MM-dd}}</enabled>

Custom placeholder markers

Override the default {{ / }} markers on any tag:

<sql open-marker="[%" close-marker="%]" null-value="N/A">
  INSERT INTO users (name, email) VALUES ('[%var{name}%]', '[%var{email}%]')
</sql>

Error handling

scheduler.TaskExecutionError += async (object sender, HTaskExecutionErrorEventArgs e, CancellationToken ct) =>
{
    Console.WriteLine($"Task failed: {e.Exception.Message}");
};

scheduler.TaskLoadingError += async (object sender, HErrorEventArgs e, CancellationToken ct) =>
{
    Console.WriteLine($"Config error: {e.Exception.Message}");
};

Worker service integration

For .NET worker services, use Com.H.Threading.Scheduler.DI for IServiceCollection integration. Installing it automatically includes this library as a dependency.

Product 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 is compatible.  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 is compatible.  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.
  • net10.0

    • Com.H (>= 10.1.0 && < 10.2.0)
  • net8.0

    • Com.H (>= 10.1.0 && < 10.2.0)
  • net9.0

    • Com.H (>= 10.1.0 && < 10.2.0)

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Com.H.Threading.Scheduler:

Package Downloads
Com.H.Threading.Scheduler.DI

Dependency injection extension for Com.H.Threading.Scheduler API to facilitate easier usage for applications that utilize IHostBuilder services DI pipeline

Com.H.Threading.Scheduler.VP.Sql

Sql server value processor for Com.H.Threading.Scheduler library

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1 0 4/15/2026
10.0.0 25 4/15/2026
9.0.0.1 240 9/8/2025
9.0.0 221 12/9/2024
8.0.0.3 221 11/29/2024
8.0.0.2 263 9/24/2024
8.0.0.1 244 9/24/2024
8.0.0 452 1/29/2024
6.0.6.4 1,285 9/3/2022
6.0.6.3 1,054 8/27/2022
6.0.6.2 1,031 8/27/2022
6.0.6.1 992 8/27/2022
5.0.17.2 1,036 8/27/2022
1.0.10 1,463 1/24/2022
1.0.9 1,299 5/8/2021
1.0.8 1,277 1/3/2021
1.0.7 1,246 1/3/2021
1.0.6 1,156 1/2/2021
1.0.5 1,117 1/2/2021
1.0.4 1,116 1/2/2021
Loading failed

Maintenance release