Enqueuing jobs
Firing off jobs only requires a few lines of code
Please read the introduction to tasks and queues before continuing with this section.
There are two options for enqueuing a job, either immediately or in the future.
Usage
Enqueuing a job immediately or in the future are functionally exactly the same with the exception of being able to pass a period into the latter.
Enqueuing a job immediately
This job will be executed immediately (as soon as a thread is available to process it)
Enqueuing a job in the future
This job will be scheduled to be executed two minutes from now (as soon as a thread is available to process it).
Options
There are a few options you can provide when enqueuing a job. Let's explore them!
Name | Description |
---|---|
name | Provide a name for your job. You can later search for jobs with this name. It does not need to be unique. |
identifier | Provide a unique identifier for your job. This is useful if you wish to link a job to an internal identifier in your system. |
timeout | Provide a timeout for the job. If a job exceeds the time out it will move to the failed state and be scheduled again for execution if it has not exceeded its maximum number of retries. |
maxRetries | Set the number of max retries. If not set then it will use the default max retries set in the initial configuration. |
arguments | Pass arguments to your job which can then be accessed during the task execution. |
A full example:
Last updated