Table of Contents

Class JobRunReport

Namespace
Quartz
Assembly
Quartz.dll

A job's report of what its run achieved: set it as Result.

public sealed record JobRunReport : IJobRunReport, IEquatable<JobRunReport>
Inheritance
JobRunReport
Implements
Inherited Members

Remarks

context.Result = JobRunReport.Skipped("no stale reservations").With("released", 0);

To have the scheduler act on a failure — retry it, run OnFailure continuations — throw. A reported Failed is history only.

Fields

MaxMetricsLength

The longest the Metrics may be as JSON: 4,000 characters. A larger object is dropped whole, and log event 1059 says so.

public const int MaxMetricsLength = 4000

Field Value

int

Remarks

The JSON escapes every character outside ASCII, so the limit is also 4,000 bytes.

MaxSummaryLength

The longest Summary the history keeps: 1,000 characters. A longer one is cut, never between the two halves of a surrogate pair.

public const int MaxSummaryLength = 1000

Field Value

int

Properties

Metrics

Named values the run measured, or null. Recorded as one JSON object of at most MaxMetricsLength characters; a larger one, or one with a value that throws while it is written, is dropped whole and the run is recorded without it.

public IReadOnlyDictionary<string, object?>? Metrics { get; init; }

Property Value

IReadOnlyDictionary<string, object>

Remarks

A value is written as a JSON string, number, boolean or null: numbers stay numbers (a non-finite double or float is a string), dates are round-trip ("O") strings, a TimeSpan is its constant ("c") form, an enum is its name, and anything else is its invariant-culture text. A value whose text throws drops the metrics, with log event 1060; the run is still recorded.

Result

What the run achieved.

public JobRunResult Result { get; init; }

Property Value

JobRunResult

Summary

One line for a reader of the history, or null. Cut to MaxSummaryLength characters when recorded.

public string? Summary { get; init; }

Property Value

string

Methods

Failed(string?)

A report that the run failed, recorded in the history only.

public static JobRunReport Failed(string? summary = null)

Parameters

summary string

What went wrong, for a reader of the history, or null.

Returns

JobRunReport

Remarks

The scheduler does not retry it, run OnFailure continuations for it, or count it against a retry policy. To have the scheduler act on a failure, throw.

Skipped(string?)

A report that the run found nothing to do. It counts as a success.

public static JobRunReport Skipped(string? summary = null)

Parameters

summary string

One line for a reader of the history, or null.

Returns

JobRunReport

Succeeded(string?)

A report that the run did its work.

public static JobRunReport Succeeded(string? summary = null)

Parameters

summary string

One line for a reader of the history, or null.

Returns

JobRunReport

With(string, object?)

A copy of this report with one more metric. A name already present takes the new value.

public JobRunReport With(string name, object? value)

Parameters

name string

The metric's name, the key in the recorded JSON object.

value object

What was measured.

Returns

JobRunReport

A new report; this one is unchanged.