Josupeit.Practices.Schedulers.Core 1.0.8

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

Josupeit.Practices.Schedulers.Core

When neither the TaskPoolScheduler nor the ChannelScheduler fits your needs, this package gives you the foundation to build your own IScheduler implementation. The heavy lifting — translating the rich IScheduler API surface into a single Enqueue call, managing sync/async bridging, and handling cancellation — is done for you. You only need to decide what to do with the work item once it arrives.

dotnet add package Josupeit.Practices.Schedulers.Core

Choosing a base class

Two base classes are available, differing in whether the scheduler itself has a lifecycle.

Scheduler — stateless, always-available

Use Scheduler when your implementation does not need to be started or stopped. You override a single method and the base class handles everything else.

public sealed class LoggingScheduler : Scheduler
{
    private readonly ILogger _logger;
    private readonly IScheduler _inner;

    public LoggingScheduler(ILogger logger, IScheduler inner)
    {
        _logger = logger;
        _inner = inner;
    }

    protected override void Enqueue(IScheduled scheduled)
    {
        _logger.LogInformation("Scheduling item {Id}", scheduled.GetHashCode());
        _ = scheduled.ExecuteAsync(CancellationToken.None);
    }
}

// No Start/Stop — just use it.
IScheduler scheduler = new LoggingScheduler(logger, new TaskPoolScheduler());
scheduler.Schedule(() => DoWork());
int result = scheduler.Schedule(() => ComputeValue());
await scheduler.ScheduleAsync(async ct => await DoWorkAsync(ct), cancellationToken);

AsyncSchedulerService — lifecycle-aware

Use AsyncSchedulerService when the scheduler manages background consumers that must be explicitly started and stopped. It extends AsyncService, so it inherits the full service lifecycle — including optional pause support — and additionally implements IScheduler through an EnqueueAsync override.

public sealed class MyQueueScheduler : AsyncSchedulerService
{
    private Channel<IScheduled>? _channel;

    protected override Task OnStartAsync(CancellationToken cancellationToken)
    {
        _channel = Channel.CreateBounded<IScheduled>(capacity: 100);
        _ = ConsumeAsync(_channel.Reader);
        return Task.CompletedTask;
    }

    protected override async Task OnStopAsync(CancellationToken cancellationToken)
    {
        _channel!.Writer.Complete();
        await _channel.Reader.Completion;
    }

    protected override Task EnqueueAsync(IScheduled scheduled, CancellationToken cancellationToken)
    {
        return _channel!.Writer.WriteAsync(scheduled, cancellationToken).AsTask();
    }
}

SchedulerService (sync) follows the same pattern but extends Service instead. Use it when the consumers themselves are synchronous.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Josupeit.Practices.Schedulers.Core:

Package Downloads
Josupeit.Practices.Schedulers.Channel

Channel-backed IScheduler with FIFO ordering, configurable parallelism, back-pressure, and pause/resume support. Built on System.Threading.Channels.

Josupeit.Practices.Schedulers.TaskPool

Thread pool IScheduler implementation for fire-and-go workloads. No lifecycle overhead — dispatches actions and functions to the thread pool immediately.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.8 199 3/10/2026