Skip to content
Tracon

JobRecord

Namespace Tracon · Assembly Tracon.Abstractions.dll

The summary of a queued job. The header of its items (JobItemRecord).

public sealed record JobRecord : IEquatable<JobRecord>
Inheritance
object ← JobRecord
Implements
IEquatable<JobRecord>
Inherited Members
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
public JobRecord()

The number of lease attempts. Increments each time a worker leases the job.

public int Attempt { get; init; }

int

The completion time (UTC). null while the job is in progress.

public DateTimeOffset? CompletedAt { get; init; }

DateTimeOffset?

The creation time (UTC).

public required DateTimeOffset CreatedAt { get; init; }

DateTimeOffset

The number of items that completed successfully.

public int DoneItems { get; init; }

int

The failure message. Populated only for JobStatus.Failed.

public string? ErrorMessage { get; init; }

string?

The number of items that failed.

public int FailedItems { get; init; }

int

The key of the IJobHandler that executes this job. See JobHandlerKeys.

public required string HandlerKey { get; init; }

string

Both the job’s classification and its dispatch identity; there is no second field. The worker matches it against the registered keys ordinally, so a job whose key nobody registered fails with JobErrorCodes.UnknownHandlerKey instead of running the wrong handler.

The job identifier.

public required Guid Id { get; init; }

Guid

The lane this job runs in. See JobLanes. A worker only leases jobs from the lanes it subscribes to (TraconSchedulingOptions.Lanes).

public string Lane { get; init; }

string

The identifier of the worker currently leasing the job. null if not leased.

public string? LeaseOwner { get; init; }

string?

The time the current lease expires (UTC). The job may be re-leased once it expires.

public DateTimeOffset? LeaseUntil { get; init; }

DateTimeOffset?

The maximum number of attempts specific to this job. If null, TraconSchedulingOptions.MaxAttempts applies.

public int? MaxAttempts { get; init; }

int?

Webhook delivery uses a ladder different from the global setting; this field prevents a single global number from being forced onto every kind of job.

The longest time one attempt of this job may run. If null, TraconSchedulingOptions.MaxDurationByHandlerKey applies to the job’s handler key, and a key the map does not list has no limit.

public TimeSpan? MaxDuration { get; init; }

TimeSpan?

When the time is up, the worker cancels the token it gave the handler. A handler that stops then fails the attempt with JobErrorCodes.MaxDurationExceeded; the job is leased again while attempts are left, and the next attempt gets the full time again. A handler that ignores its token is waited for, and keeps its worker slot until it returns. One that returns normally after the time is up completes the job.

Kept in the store beside JobRecord.MaxAttempts. A store that does not keep it loses it: the job then runs under the map’s value, or without a limit. A stored value a timer cannot arm (outside 1 ms to about 49.7 days) is logged and skipped the same way.

The input set or parameters.

public JsonElement Payload { get; init; }

JsonElement

An unset payload is stored as the empty JSON array, never as JsonValueKind.Undefined or JSON null: an undefined value cannot be written as JSON, and SQL Server rejects a null literal in a JSON column. Every reader treats the empty array as “no payload”.

The identifier of the schedule that produced this job. null for manually created (one-off) jobs.

public Guid? ScheduleId { get; init; }

Guid?

The earliest time the job is eligible to run (UTC).

public required DateTimeOffset ScheduledFor { get; init; }

DateTimeOffset

The time the first lease happened (UTC).

public DateTimeOffset? StartedAt { get; init; }

DateTimeOffset?

The job’s current status.

public required JobStatus Status { get; init; }

JobStatus

The agent or workflow name to run.

public required string TargetName { get; init; }

string

The tenant the job belongs to.

public required string TenantId { get; init; }

string

The total number of items.

public int TotalItems { get; init; }

int

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(JobRecord? other)

other JobRecord?

bool

public override int GetHashCode()

int

public override string ToString()

string

public static bool operator ==(JobRecord? left, JobRecord? right)

left JobRecord?

right JobRecord?

bool

public static bool operator !=(JobRecord? left, JobRecord? right)

left JobRecord?

right JobRecord?

bool