FabulousScheduler.Core 5.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package FabulousScheduler.Core --version 5.0.1
                    
NuGet\Install-Package FabulousScheduler.Core -Version 5.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="FabulousScheduler.Core" Version="5.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FabulousScheduler.Core" Version="5.0.1" />
                    
Directory.Packages.props
<PackageReference Include="FabulousScheduler.Core" />
                    
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 FabulousScheduler.Core --version 5.0.1
                    
#r "nuget: FabulousScheduler.Core, 5.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 FabulousScheduler.Core@5.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=FabulousScheduler.Core&version=5.0.1
                    
Install as a Cake Addin
#tool nuget:?package=FabulousScheduler.Core&version=5.0.1
                    
Install as a Cake Tool

Core (FabulousScheduler.Core)

The FabulousScheduler.Core package holds the shared primitives that both subsystems build on. It contains no scheduling logic β€” only the contracts (IJob, IJobScheduler, IJobOk, IJobFail) and the JobResult<TOk, TFail> type.

For the high-level picture see General concepts.

πŸ“– Contents


IJob <a id="ijob" />

FabulousScheduler.Core.Interfaces.IJob is the identity every job shares. It extends IDisposable and IAsyncDisposable.

Member Type Meaning
ID Guid Unique identifier, generated when the job is created.
Name string Human-readable name. Defaults to "anonimouse" when not supplied.
LastExecute DateTime? Last time the job ran (any outcome). null if it has never run.
LastSuccessExecute DateTime? Last time the job ran successfully. null if it has never succeeded.

The two subsystem interfaces extend IJob and add their own members:

  • IRecurringJob β€” adds Category, State, SleepDuration, TotalRun, TotalFail, ExecuteAsync(). See Recurring.md.
  • IQueueJob β€” adds State, TotalRun, Attempts, ExecuteAsync(), ResetState(). See QueueBased.md.

IJobScheduler <a id="ijobscheduler" />

FabulousScheduler.Core.Interfaces.IJobScheduler is the minimal scheduler contract; it extends IDisposable.

public interface IJobScheduler : IDisposable
{
    void RunScheduler();   // start the scheduler
}

Both IRecurringJobScheduler and IQueueJobScheduler extend it and add a JobResultEventHandler delegate / JobResultEvent for result callbacks (with subsystem -specific job and result types).


IJobOk / IJobFail <a id="results" />

The two markers carried by a result. Both expose only the job ID; concrete payloads (message, reason, exception) are added by the subsystem-specific implementations.

public interface IJobOk   { Guid ID { get; } }
public interface IJobFail { Guid ID { get; } }
Subsystem Ok type Fail type Extra members on the fail type
Recurring Recurring.Result.JobOk Recurring.Result.JobFail (plain class) Reason (JobFailEnum), Message, Exception?
Queue Queue.Result.JobOk Queue.Result.JobFail (: System.Exception) Reason (QueueJobFailEnum), Exception?

⚠️ Design asymmetry: the queue JobFail derives from Exception, the recurring one is a plain class. Use them as result objects, not as things to throw.


JobResult<TOk, TFail> <a id="jobresult" />

FabulousScheduler.Core.Types.JobResult<TOk, TFail> (where TOk : IJobOk, where TFail : IJobFail) is a small discriminated union. It holds either a success value or a failure value, never both, and never uses exceptions for control flow.

Creating a result

A result is created implicitly from either side β€” you rarely call a constructor:

JobResult<JobOk, JobFail> ok   = new JobOk(id);                  // implicit -> success
JobResult<JobOk, JobFail> fail = new JobFail(reason, id, "msg"); // implicit -> failure

Inspecting

Member Type Meaning
IsSuccess bool true when it holds a TOk.
IsFail bool true when it holds a TFail.
JobID Guid The job's ID, regardless of outcome.
GetFail() TFail? The failure, or null on success.

Consuming

Method Returns Use it to…
Do(Action<TOk> success, Action<TFail> failure) void run a side effect per branch
Match<TResult>(Func<TOk,TResult> success, Func<TFail,TResult> failure) TResult map both branches to one value
Match<TResult,TFailResult>(Func<TOk?,TFail?,(TResult,TFailResult)> f) (TResult, TFailResult) low-level tuple projection
MatchAsync<TResult>(Func<TOk,Task<TResult>>, Func<TFail,Task<TResult>>) Task<TResult> async mapping
// Side effect per branch
result.Do(
    success: ok   => Console.WriteLine("{0} succeeded", ok.JobID),
    failure: fail => Console.WriteLine("{0} failed: {1}", fail.JobID, fail.Message)
);

// Map to a value
string msg = result.Match(
    success: ok   => $"{ok.JobID} succeeded",
    failure: fail => $"{fail.JobID} failed: {fail.Message}"
);

// Async
int code = await result.MatchAsync(
    success: async ok   => { await Task.Yield(); return 0; },
    failure: async fail => { await Task.Yield(); return 1; }
);
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 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 (2)

Showing the top 2 NuGet packages that depend on FabulousScheduler.Core:

Package Downloads
FabulousScheduler.Cron

Write your self recurring jobs

FabulousScheduler.Queue

Write your self queue-based jobs

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.1.0 154 8/1/2026
5.0.1 179 6/18/2026
5.0.0 165 6/18/2026
4.0.0 356 3/20/2025
3.1.3 10,116 6/14/2024
3.1.0 11,954 2/3/2024
3.0.1 316 1/27/2024
2.2.7 681 1/17/2024
2.2.6 292 1/17/2024
2.2.5 306 1/17/2024
2.2.4 276 1/17/2024
2.2.3 316 1/12/2024
2.2.2 306 1/9/2024
2.2.1 299 1/8/2024
2.1.6 350 1/2/2024
2.1.5 359 1/1/2024
2.1.2 453 1/1/2024