Since the DLQ can have a large number of messages, they are paginated.
You can go through the results using the cursor
.
import { Client } from "@upstash/qstash";
const client = new Client("<QSTASH_TOKEN>");
const dlq = client.dlq();
const all_messages = [];
let cursor = null;
while (true) {
const res = await dlq.listMessages({ cursor });
all_messages.push(...res.messages);
cursor = res.cursor;
if (!cursor) {
break;
}
}
import { Client } from "@upstash/qstash";
const client = new Client({ token: "<QSTASH_TOKEN>" });
const dlq = client.dlq();
await dlq.delete("dlqId");