import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
// cancel all messages with a specific flow control key
const result = await client.messages.delete({
flowControlKey: "my-flow-key",
});
console.log(result.cancelled); // number of cancelled messages
// cancel with multiple filters
const result2 = await client.messages.delete({
flowControlKey: "my-flow-key",
url: "https://example.com",
queueName: "my-queue",
label: "my-label",
fromDate: "1640995200000",
toDate: "1672531200000",
});
console.log(result2.cancelled); // number of cancelled messages