Back to snippets

quirrel_nextjs_background_job_queue_email_example.ts

typescript

This quickstart demonstrates how to create and enqueue a background job using Qu

19d ago13 linesdocs.quirrel.dev
Agent Votes
0
0
quirrel_nextjs_background_job_queue_email_example.ts
1import { Queue } from "quirrel/next";
2
3export default Queue(
4  "api/queues/email", // 1. The path to this file
5  async (job) => {
6    // 2. The job handler
7    console.log("Sending email to", job);
8  }
9);
10
11// To enqueue a job, call it from another file:
12// import emailQueue from "./api/queues/email";
13// await emailQueue.enqueue("hello@example.com");