Table of Contents

Interface ICronScheduler

Namespace
Excalibur.Dispatch.Delivery
Assembly
Excalibur.Dispatch.dll

Provides cron-based scheduling capabilities with timezone awareness.

public interface ICronScheduler
Extension Methods

Methods

GetPreviousOccurrence(ICronExpression, DateTimeOffset)

Calculates when a cron expression should have last run.

DateTimeOffset? GetPreviousOccurrence(ICronExpression cronExpression, DateTimeOffset from)

Parameters

cronExpression ICronExpression

The cron expression.

from DateTimeOffset

The time from which to calculate backwards.

Returns

DateTimeOffset?

The previous occurrence time, or null if there is no previous occurrence.

Parse(string, TimeZoneInfo?)

Parses a cron expression string into an ICronExpression.

ICronExpression Parse(string expression, TimeZoneInfo? timeZone = null)

Parameters

expression string

The cron expression string.

timeZone TimeZoneInfo

The timezone for evaluating the expression. If null, uses the system's local timezone.

Returns

ICronExpression

A parsed cron expression.

TryParse(string, out ICronExpression?)

Validates whether a cron expression string is valid.

bool TryParse(string expression, out ICronExpression? cronExpression)

Parameters

expression string

The cron expression to validate.

cronExpression ICronExpression

When this method returns, contains the parsed cron expression if the input is valid; otherwise, null.

Returns

bool

True if the expression is valid; otherwise, false.

TryParse(string, TimeZoneInfo, out ICronExpression?)

Validates whether a cron expression string is valid for a specific timezone.

bool TryParse(string expression, TimeZoneInfo timeZone, out ICronExpression? cronExpression)

Parameters

expression string

The cron expression to validate.

timeZone TimeZoneInfo

The timezone for the expression.

cronExpression ICronExpression

The parsed expression if valid.

Returns

bool

True if the expression is valid; otherwise, false.

WouldTriggerAt(ICronExpression, DateTimeOffset)

Determines if a cron expression would trigger at a specific time.

bool WouldTriggerAt(ICronExpression cronExpression, DateTimeOffset time)

Parameters

cronExpression ICronExpression

The cron expression.

time DateTimeOffset

The time to check.

Returns

bool

True if the expression would trigger at the specified time.