When a SchedulerX job runs, the system passes a JobContext object to your job handler. This object provides runtime metadata -- job and instance identifiers, scheduling times, retry state, sharding configuration, and workflow data -- that you use to implement conditional logic, track execution state, and coordinate distributed tasks.
Identifiers
These parameters uniquely identify the job, its execution instance, and any associated task or workflow.
| Type | Parameter | Description |
|---|---|---|
long | jobId | Unique identifier of the job. |
long | jobInstanceId | Unique identifier of this execution instance. |
Long | workflowId | Identifier of the workflow that contains this job. |
long | wfInstanceId | Identifier of the current workflow execution instance. |
long | taskId | Identifier of the task within a distributed job. The root task ID is 0. |
workflowId uses the nullable Long wrapper type, while the other ID parameters use the primitive long type.
Scheduling
| Type | Parameter | Description |
|---|---|---|
DateTime | scheduleTime | Scheduled trigger time of this job instance. |
DateTime | dataTime | Time when the job is run on the instance. |
Job configuration
| Type | Parameter | Description |
|---|---|---|
String | jobType | Type of the job. |
String | taskName | Name of the task. |
Object | task | Task body. |
String | jobParameters | Static parameters configured in the SchedulerX console. Maximum size: 10,000 bytes. |
String | instanceParameters | Dynamic parameters passed through the API when triggering a job instance. |
Retry state
SchedulerX tracks retry attempts at both the job-instance and task levels.
| Type | Parameter | Description |
|---|---|---|
int | maxAttempt | Maximum retry count for the job instance. |
int | attempt | Current retry attempt number for the job instance. |
int | taskMaxAttempt | Maximum retry count for the current task. |
int | taskAttempt | Current retry attempt number for the current task. |
Use attempt and maxAttempt to implement custom retry logic -- for example, increasing backoff intervals or sending alerts on the final attempt.
Sharding
These parameters are available only when the job Execution mode is set to Broadcast run or Shard run.
| Type | Parameter | Description | Availability |
|---|---|---|---|
Long | shardingId | ID of the shard assigned to this worker. | Broadcast run, Shard run |
String | shardingParameter | Sharding parameter that defines how work is partitioned. | Shard run only |
int | shardingNum | Total number of shards. | Broadcast run, Shard run |
Workflow data
| Type | Parameter | Description |
|---|---|---|
List<JobInstanceData> | upstreamData | Data from upstream job instances in the workflow. A workflow may have multiple upstream instances. |