All Products
Search
Document Center

Microservices Engine:JobContext parameters

Last Updated:Mar 10, 2026

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.

TypeParameterDescription
longjobIdUnique identifier of the job.
longjobInstanceIdUnique identifier of this execution instance.
LongworkflowIdIdentifier of the workflow that contains this job.
longwfInstanceIdIdentifier of the current workflow execution instance.
longtaskIdIdentifier 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

TypeParameterDescription
DateTimescheduleTimeScheduled trigger time of this job instance.
DateTimedataTimeTime when the job is run on the instance.

Job configuration

TypeParameterDescription
StringjobTypeType of the job.
StringtaskNameName of the task.
ObjecttaskTask body.
StringjobParametersStatic parameters configured in the SchedulerX console. Maximum size: 10,000 bytes.
StringinstanceParametersDynamic parameters passed through the API when triggering a job instance.

Retry state

SchedulerX tracks retry attempts at both the job-instance and task levels.

TypeParameterDescription
intmaxAttemptMaximum retry count for the job instance.
intattemptCurrent retry attempt number for the job instance.
inttaskMaxAttemptMaximum retry count for the current task.
inttaskAttemptCurrent 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.

TypeParameterDescriptionAvailability
LongshardingIdID of the shard assigned to this worker.Broadcast run, Shard run
StringshardingParameterSharding parameter that defines how work is partitioned.Shard run only
intshardingNumTotal number of shards.Broadcast run, Shard run

Workflow data

TypeParameterDescription
List<JobInstanceData>upstreamDataData from upstream job instances in the workflow. A workflow may have multiple upstream instances.