Handling Jobs

Jobs are handled asynchronously, reusing the routing logic already available in your frontend framework. Before a job reaches the Handler, the Taskless integration takes care of verifying the signature and decrypting the payload. The core of a Job Handler is an asynchronous function, which receives two parameters: job and meta.

The second argument to createQueue is the Job Handler (or handler for short). It's where the bulk of your job processing occurs.

1import { createQueue } from "@taskless/<integration>";
3const MyQueue = createQueue(
4 "example-queue",
5 "/api/example-queue",
6 async (job, meta) => {
7 /*
8 |
9 | This is the Job Handler body
10 |
11 */
12 }

Job Handler Arguments

job: T
This is your job object. If you are using typescript and defined your queue payload of type T, it will be reflected here in the handler.

The Job Metadata. Contains several useful properties about the job, as well as a recursive reference to the Queue object for type safety.

The name of the queue in use for the job.

The Job Identifier used in scheduling this job.

The ID for the Project associated with this queue.

Contains a reference to the Taskless Queue (Queue<T>), containing the standard set of Taskless queue methods: enqueue, cancel, and bulk