Skip to main content

SvelteKit

src/routes/greetingsQueue/+server.ts
import { Queue } from "quirrel/sveltekit";

const queue = Queue(
"greetingsQueue", // 👈 the route it's reachable on
async (job, meta) => {
// do something
}
);

export const POST = queue

export default queue

Creates a new Queue. Make sure to export it as a server route, 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.