cbq Model
This model is provided to make certain tasks easier when defining and dispatching jobs, chains, and batches.
dispatch
Dispatches a job or chain of jobs.
job
string | Job | array<Job>
true
A Job instance or a WireBox ID of a Job instance. If the WireBox ID doesn't exist, a NonExecutableJob
instance will be used instead. This allows you to dispatch a Job from a server where that Job component is not defined. If an array is passed, a Job Chain is created and dispatched.
properties
struct
false
{}
A struct of properties for the Job instance.
chain
array<Job>
false
[]
An array of Jobs to chain after this Job.
queue
string
false
The queue the Job belongs to.
connection
string
false
The Connection to dispatch the Job on.
backoff
numeric
false
The amount of time, in seconds, to wait between attempting Jobs.
timeout
numeric
false
The amount of time, in seconds, to wait before treating a Job as erroring.
maxAttempts
numeric
false
The maximum amount of attempts of a Job before treating the Job as failed.
Return: The dispatched Job instance.
job
Creates a job or chain of jobs to be dispatched.
job
string | Job | array<Job>
true
A Job instance or a WireBox ID of a Job instance. If the WireBox ID doesn't exist, a NonExecutableJob
instance will be used instead. This allows you to dispatch a Job from a server where that Job component is not defined. If an array is passed, a Job Chain is created and dispatched.
properties
struct
false
{}
A struct of properties for the Job instance.
chain
array<Job>
false
[]
An array of Jobs to chain after this Job.
queue
string
false
The queue the Job belongs to.
connection
string
false
The Connection to dispatch the Job on.
backoff
numeric
false
The amount of time, in seconds, to wait between attempting Jobs.
timeout
numeric
false
The amount of time, in seconds, to wait before treating a Job as erroring.
maxAttempts
numeric
false
The maximum amount of attempts of a Job before treating the Job as failed.
Return: The new Job instance.
chain
Creates a chain of jobs to be ran.
Alias for calling firstJob.chain( otherJobs )
.
jobs
array<Job>
true
The array of jobs to run in order in a chain.
Return: The first job of the chain with the chained jobs configured to be dispatched.
batch
Creates a PendingBatch from the Jobs provided.
To use batches, you must first configure a BatchRepository
.
Learn more in the Batched Jobs documentation.
jobs
array<Job>
true
An array of jobs to batch together.
Return: The PendingBatch to be dispatched.