Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions samples/Trax.Samples.Scheduler/ManifestNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public static class ManifestNames
// ── Delayed / One-Off Jobs ───────────────────────────────────────
public const string DelayedGreeting = "delayed-greeting";

// ── Exclusion Windows ─────────────────────────────────────────────
public const string WeekdayOnly = "weekday-only";

// ── Table Names ──────────────────────────────────────────────────────
public const string CustomerTable = "Customer";
public const string TransactionTable = "Transaction";
Expand Down
25 changes: 25 additions & 0 deletions samples/Trax.Samples.Scheduler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Trax.Effect.Data.Postgres.Extensions;
using Trax.Effect.Enums;
using Trax.Effect.Extensions;
using Trax.Effect.Models.Manifest;
using Trax.Effect.Provider.Json.Extensions;
using Trax.Effect.Provider.Parameter.Extensions;
using Trax.Effect.StepProvider.Progress.Extensions;
Expand Down Expand Up @@ -268,6 +269,30 @@
new HelloWorldInput { Name = "Delayed One-Off Job" },
TimeSpan.FromMinutes(1)
);

// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 9. EXCLUSION WINDOWS
// Exclude() adds exclusion windows to skip execution during specific
// periods. Multiple exclusions can be combined — if ANY exclusion
// matches, the manifest is skipped. Built-in types:
// - DaysOfWeek — exclude specific days (e.g., weekends)
// - Dates — exclude specific dates (e.g., holidays)
// - DateRange — exclude a contiguous date range
// - TimeWindow — exclude a daily time window (e.g., maintenance)
//
// Excluded periods are "intentionally skipped", not misfires.
// When the excluded period ends, normal scheduling resumes.
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
scheduler.Schedule<IHelloWorldTrain>(
ManifestNames.WeekdayOnly,
new HelloWorldInput { Name = "Weekday Report" },
Every.Seconds(30),
o =>
o.Exclude(Exclude.DaysOfWeek(DayOfWeek.Saturday, DayOfWeek.Sunday))
.Exclude(
Exclude.TimeWindow(TimeOnly.Parse("02:00"), TimeOnly.Parse("04:00"))
)
);
})
);

Expand Down