Immediate.Jobs.NodaTime
0.5.1
dotnet add package Immediate.Jobs.NodaTime --version 0.5.1
NuGet\Install-Package Immediate.Jobs.NodaTime -Version 0.5.1
<PackageReference Include="Immediate.Jobs.NodaTime" Version="0.5.1" />
<PackageVersion Include="Immediate.Jobs.NodaTime" Version="0.5.1" />
<PackageReference Include="Immediate.Jobs.NodaTime" />
paket add Immediate.Jobs.NodaTime --version 0.5.1
#r "nuget: Immediate.Jobs.NodaTime, 0.5.1"
#:package Immediate.Jobs.NodaTime@0.5.1
#addin nuget:?package=Immediate.Jobs.NodaTime&version=0.5.1
#tool nuget:?package=Immediate.Jobs.NodaTime&version=0.5.1
Immediate.Jobs.NodaTime
NodaTime scheduling overloads and job payload serialization for Immediate.Jobs.
Installation
dotnet add package Immediate.Jobs --prerelease
dotnet add package Immediate.Jobs.NodaTime --prerelease
Immediate.Jobs reports diagnostic IJOB0004 when a generated job payload uses NodaTime types without this package.
Scheduling with NodaTime
Import Immediate.Jobs.NodaTime to schedule with Duration, Instant, and DateTimeZone:
using Immediate.Jobs.NodaTime;
using NodaTime;
JobHandle delayed = await scheduler.ScheduleAsync(
payload,
Duration.FromMinutes(15),
cancellationToken);
JobHandle scheduled = await scheduler.ScheduleAsync(
payload,
SystemClock.Instance.GetCurrentInstant() + Duration.FromHours(1),
cancellationToken);
JobHandle continuation = await scheduler.ScheduleAfterAsync(
payload,
scheduled,
Duration.FromMinutes(5),
cancellationToken: cancellationToken);
await recurringScheduler.AddOrUpdateRecurringAsync(
"tenant-cleanup",
"0 3 * * *",
DateTimeZoneProviders.Tzdb["Europe/Vienna"],
cancellationToken);
The same method family covers fair-queue group IDs and workflow construction. Inside an open batch, Schedule accepts
an Instant or Duration; ScheduleAfter applies a Duration after one or several parent jobs reach the selected
outcome:
await using var batch = batches.Begin();
var root = scheduler.Schedule(payload, batch, SystemClock.Instance.GetCurrentInstant());
var child = scheduler.ScheduleAfter(
payload,
root,
Duration.FromMinutes(10));
_ = await batch.CommitAsync(cancellationToken);
NodaTime overloads also accept JobDetails for work added by a running job. They follow the core scheduler's
ContinuationOptions behavior.
Payload serialization
Immediate.Jobs has its own IJobSerializer; it does not use ASP.NET Core's JSON options. When an application owns its
JSON settings, create dedicated JsonSerializerOptions and register a NodaTimeJobSerializer before
AddMyAppJobs():
using System.Text.Json;
using Immediate.Jobs.NodaTime;
using Immediate.Jobs.Shared.Interfaces;
using NodaTime;
var jobJsonOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web)
{
WriteIndented = false,
PropertyNameCaseInsensitive = true,
};
builder.Services.AddMyAppHandlers();
builder.Services.AddSingleton<IJobSerializer>(
new NodaTimeJobSerializer(
jobJsonOptions,
DateTimeZoneProviders.Tzdb
)
);
builder.Services.AddMyAppJobs()
.ConfigureStorage(storage => storage.UseInMemory());
NodaTimeJobSerializer adds NodaTime's System.Text.Json converters to the supplied options. Generated schedulers and
invokers build their AOT-safe payload metadata from those same options, so custom naming, converters, and other JSON
settings apply consistently when a job is written and read.
Register the serializer before AddMyAppJobs(). Jobs registers its default serializer only when no IJobSerializer
has already been registered.
If web JSON defaults and the TZDB time-zone provider are sufficient, AddImmediateJobsNodaTime() is a shorter
convenience registration:
builder.Services.AddMyAppHandlers();
builder.Services.AddMyAppJobs()
.ConfigureStorage(storage => storage.UseInMemory());
builder.Services.AddImmediateJobsNodaTime();
The convenience method replaces the default IJobSerializer; do not combine it with the explicit serializer
registration above. Pass an IDateTimeZoneProvider to either NodaTimeJobSerializer or
AddImmediateJobsNodaTime(...) when the application does not use TZDB.
Every worker that reads stored jobs must use the same serializer options and a time-zone provider that recognizes the same IDs. Treat these settings as part of the durable payload contract: changing converters or JSON names while jobs are still queued can make their stored payloads unreadable.
Call JsonSerializerOptions.UseNodaTime(...) only when JSON options outside the Jobs serializer need the same NodaTime
converters.
More information
| 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 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. net11.0 is compatible. |
-
net10.0
- NodaTime (>= 3.3.3)
- NodaTime.Serialization.SystemTextJson (>= 1.4.0)
-
net11.0
- NodaTime (>= 3.3.3)
- NodaTime.Serialization.SystemTextJson (>= 1.4.0)
-
net8.0
- NodaTime (>= 3.3.3)
- NodaTime.Serialization.SystemTextJson (>= 1.4.0)
-
net9.0
- NodaTime (>= 3.3.3)
- NodaTime.Serialization.SystemTextJson (>= 1.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.