Skip to main content

Remix

app/queues/someQueue.server.ts
import { Queue } from "quirrel/remix";

export default Queue(
"queues/someQueue",
async (job, meta) => {
// do something
},
);
app/routes/queues/someQueue.ts
import someQueue from "~/queues/someQueue.server";

export const action = someQueue;

Creates a new Queue. Make sure to export it first from a file with the .server extension before the file type so it gets picked up by the server code pruning. Then export it from a route action, otherwise it won't work.

Parameters

function Queue<T>(
path: string,
worker: (job: T, meta: JobMeta): Promise<void>,
defaultJobOptions?: { exclusive?: boolean }
): QueueInstance<T>
ParameterUsage
pathThe route that this queue is reachable at.
workera function that takes the job's payload and returns a Promise
defaultJobOptionsOptional. Use to set default options applied to every job.