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.
Arguments | Type | Required | Default | Description |
---|---|---|---|---|
job | string | Job | array<Job> |
| A Job instance or a WireBox ID of a Job instance. If the WireBox ID doesn't exist, a | |
properties | struct |
|
| A struct of properties for the Job instance. |
chain | array<Job> |
|
| An array of Jobs to chain after this Job. |
queue | string |
| The queue the Job belongs to. | |
connection | string |
| The Connection to dispatch the Job on. | |
backoff | numeric |
| The amount of time, in seconds, to wait between attempting Jobs. | |
timeout | numeric |
| The amount of time, in seconds, to wait before treating a Job as erroring. | |
maxAttempts | numeric |
| 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.
Arguments | Type | Required | Default | Description |
---|---|---|---|---|
job | string | Job | array<Job> |
| A Job instance or a WireBox ID of a Job instance. If the WireBox ID doesn't exist, a | |
properties | struct |
|
| A struct of properties for the Job instance. |
chain | array<Job> |
|
| An array of Jobs to chain after this Job. |
queue | string |
| The queue the Job belongs to. | |
connection | string |
| The Connection to dispatch the Job on. | |
backoff | numeric |
| The amount of time, in seconds, to wait between attempting Jobs. | |
timeout | numeric |
| The amount of time, in seconds, to wait before treating a Job as erroring. | |
maxAttempts | numeric |
| 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 )
.
Arguments | Type | Required | Default | Description |
---|---|---|---|---|
jobs | array<Job> |
| 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.
Arguments | Type | Required | Default | Description |
---|---|---|---|---|
jobs | array<Job> |
| An array of jobs to batch together. |
Return: The PendingBatch to be dispatched.