Cloud service

Job queue

Many service perform time-consuming jobs like generating a PDF report, sending an e-mail, rendering a video, etc. Performing all these jobs in sequence when handling an HTTP request increases the response time and negatively impacts the user's experience.

To keep your service snappy, you can attach a job queue to your service. This allows you to push these time-consuming jobs onto a queue to be processed asynchronously by a background worker.

Configuration as code

To configure a job queue in your code editor, use the following variables in the service's configuration as code file.

Example

# service: ...

job_queues:
  - name: jobs
    timeout: 300

Variables

name
required
string

The name of the job queue must use snake_case notation. In addition, job queues within a service cannot share the same name.

retries
required
integer

The number of times the execution of the job is automatically retried after a failure.

minimum: 0
maximum: 5
default: 0
timeout
required
string

The number of seconds after which the execution of the job times out.

minimum: 10
maximum: 600
default: 30
path
required
string

The path of the endpoint that is called by the job queue to execute a job.

default: /shipmate/handle-job