Examples
Queues
Create a queue with parallelism 2
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();
Delete Queue
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
const queueName = "upstash-queue";
await client.queue({ queueName: queueName }).delete();
Pause/Resume a queue
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();