Skip to content

CronTickerEntity

Entity for cron-based recurring job scheduling.

Type Definition

csharp
public class CronTickerEntity : BaseTickerEntity
{
    public string Expression { get; set; }
    public byte[] Request { get; set; }
    public int Retries { get; set; }
    public int[] RetryIntervals { get; set; }
}

Properties

PropertyTypeAccessDescription
ExpressionstringRead/WriteCron expression (6-part format required: second minute hour day month day-of-week)
Requestbyte[]Read/WriteSerialized request data (use TickerHelper.CreateTickerRequest)
RetriesintRead/WriteMaximum number of retry attempts
RetryIntervalsint[]Read/WriteRetry intervals in seconds

Cron Expression Format

Must be 6-part format: second minute hour day month day-of-week

Examples:

  • "0 0 0 * * *" - Daily at midnight
  • "0 0 9 * * *" - Daily at 9:00 AM
  • "0 */5 * * * *" - Every 5 minutes
  • "*/10 * * * * *" - Every 10 seconds
  • "0 0 9,17 * * *" - At 9 AM and 5 PM daily
  • "0 30 14 * * 1" - Every Monday at 2:30 PM

Required Format

All cron expressions must include the seconds field (6 parts). The format is: second minute hour day month day-of-week.

Example Usage

csharp
var cronTicker = new CronTickerEntity
{
    Function = "GenerateDailyReport",
    Description = "Daily sales report",
    Expression = "0 0 0 * * *", // Daily at midnight
    Request = TickerHelper.CreateTickerRequest(new ReportRequest
    {
        ReportType = "Daily"
    }),
    Retries = 2,
    RetryIntervals = new[] { 300, 900 }
};

Property Constraints

  • Function - Must not be null or empty, must match [TickerFunction] attribute
  • Expression - Must be valid 6-part cron expression that is parseable
  • Expression must calculate a valid next occurrence

See Also

Built by Albert Kunushevci