Skip to content

JobContext

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The context available during an IJobHandler execution.

public sealed class JobContext

objectJobContext

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

The handler does not access IJobStore directly; this keeps the handler focused only on execution logic and removes the need to set up a fake store in a unit test.

public JobContext()

Checks whether the job was cancelled by an external request (POST .../cancel). The handler supports cooperative cancellation by checking this between items.

public required Func<CancellationToken, ValueTask<bool>> IsCancelledAsync { get; init; }

Func<CancellationToken, ValueTask<bool>>

The job’s items, by sequence number.

public required IReadOnlyList<JobItemRecord> Items { get; init; }

IReadOnlyList<JobItemRecord>

The record of the job being executed.

public required JobRecord Job { get; init; }

JobRecord

Reports an item’s processing result. The handler must call this as each item is processed; the result is reflected into the persistent store and the job’s counters.

public required Func<JobItemResult, CancellationToken, ValueTask> ReportItemAsync { get; init; }

Func<JobItemResult, CancellationToken, ValueTask>