Create a queue with parallelism 2
Enqueue a message with labels
enqueue and enqueueJSON accept the same options as publish, including
label. Labels let you tag the message so you can later filter it in the
logs.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
const queueName = "upstash-queue";
await client.queue({ queueName }).upsert({ parallelism: 2 });
const queueDetails = await client.queue({ queueName }).get();
enqueue and enqueueJSON accept the same options as publish, including
label. Labels let you tag the message so you can later filter it in the
logs.
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
const queue = client.queue({ queueName: "upstash-queue" });
await queue.enqueueJSON({
url: "https://my-api...",
body: { hello: "world" },
label: ["team-a", "high-priority"], // single string or array
});
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
const queueName = "upstash-queue";
await client.queue({ queueName: queueName }).delete();
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
const name = "upstash-pause-resume-queue";
const queue = client.queue({ queueName: name });
await queue.upsert({ parallelism: 1 });
// pause queue
await queue.pause();
const queueInfo = await queue.get();
console.log(queueInfo.paused); // prints true
// resume queue
await queue.resume();
Was this page helpful?