Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@
"redis/sdks/ts/commands/auth/ping"
]
},
{
"group": "Connection",
"pages": [
"redis/sdks/ts/commands/connection/client_setinfo"
]
},
{
"group": "Bitmap",
"pages": [
Expand Down Expand Up @@ -209,6 +215,8 @@
"redis/sdks/ts/commands/hash/hexpiretime",
"redis/sdks/ts/commands/hash/hget",
"redis/sdks/ts/commands/hash/hgetall",
"redis/sdks/ts/commands/hash/hgetdel",
"redis/sdks/ts/commands/hash/hgetex",
"redis/sdks/ts/commands/hash/hincrby",
"redis/sdks/ts/commands/hash/hincrbyfloat",
"redis/sdks/ts/commands/hash/hkeys",
Expand All @@ -217,6 +225,7 @@
"redis/sdks/ts/commands/hash/hrandfield",
"redis/sdks/ts/commands/hash/hscan",
"redis/sdks/ts/commands/hash/hset",
"redis/sdks/ts/commands/hash/hsetex",
"redis/sdks/ts/commands/hash/hpersist",
"redis/sdks/ts/commands/hash/hpexpire",
"redis/sdks/ts/commands/hash/hpexpireat",
Expand Down Expand Up @@ -353,10 +362,12 @@
"group": "Stream",
"pages": [
"redis/sdks/ts/commands/stream/xack",
"redis/sdks/ts/commands/stream/xackdel",
"redis/sdks/ts/commands/stream/xadd",
"redis/sdks/ts/commands/stream/xautoclaim",
"redis/sdks/ts/commands/stream/xclaim",
"redis/sdks/ts/commands/stream/xdel",
"redis/sdks/ts/commands/stream/xdelex",
"redis/sdks/ts/commands/stream/xgroup",
"redis/sdks/ts/commands/stream/xinfo",
"redis/sdks/ts/commands/stream/xlen",
Expand Down Expand Up @@ -423,6 +434,12 @@
"redis/sdks/py/commands/auth/ping"
]
},
{
"group": "Connection",
"pages": [
"redis/sdks/py/commands/connection/client_setinfo"
]
},
{
"group": "Bitmap",
"pages": [
Expand Down Expand Up @@ -465,6 +482,8 @@
"redis/sdks/py/commands/hash/hexpiretime",
"redis/sdks/py/commands/hash/hget",
"redis/sdks/py/commands/hash/hgetall",
"redis/sdks/py/commands/hash/hgetdel",
"redis/sdks/py/commands/hash/hgetex",
"redis/sdks/py/commands/hash/hincrby",
"redis/sdks/py/commands/hash/hincrbyfloat",
"redis/sdks/py/commands/hash/hkeys",
Expand All @@ -479,6 +498,7 @@
"redis/sdks/py/commands/hash/hpexpiretime",
"redis/sdks/py/commands/hash/hpttl",
"redis/sdks/py/commands/hash/hmset",
"redis/sdks/py/commands/hash/hsetex",
"redis/sdks/py/commands/hash/hsetnx",
"redis/sdks/py/commands/hash/hstrlen",
"redis/sdks/py/commands/hash/httl",
Expand Down Expand Up @@ -611,10 +631,12 @@
"group": "Stream",
"pages": [
"redis/sdks/py/commands/stream/xack",
"redis/sdks/py/commands/stream/xackdel",
"redis/sdks/py/commands/stream/xadd",
"redis/sdks/py/commands/stream/xautoclaim",
"redis/sdks/py/commands/stream/xclaim",
"redis/sdks/py/commands/stream/xdel",
"redis/sdks/py/commands/stream/xdelex",
"redis/sdks/py/commands/stream/xgroup_create",
"redis/sdks/py/commands/stream/xgroup_createconsumer",
"redis/sdks/py/commands/stream/xgroup_delconsumer",
Expand Down Expand Up @@ -1047,8 +1069,8 @@
{
"group": "REST API",
"openapi": {
"source": "qstash/openapi.yaml",
"directory": "qstash/api-refence"
"source": "qstash/openapi.yaml",
"directory": "qstash/api-refence"
},
"pages": [
"qstash/api/authentication",
Expand Down Expand Up @@ -1190,6 +1212,7 @@
"group": "client.dlq",
"pages": [
"workflow/basics/client/dlq/list",
"workflow/basics/client/dlq/delete",
"workflow/basics/client/dlq/restart",
"workflow/basics/client/dlq/resume",
"workflow/basics/client/dlq/callback"
Expand Down Expand Up @@ -1257,7 +1280,6 @@
"workflow/features/invoke/serveMany"
]
}

]
},
{
Expand Down Expand Up @@ -1590,9 +1612,7 @@
},
{
"group": "Account",
"pages": [
"GET /auditlogs"
]
"pages": ["GET /auditlogs"]
},
{
"group": "DevOps",
Expand Down
98 changes: 96 additions & 2 deletions qstash/sdks/ts/examples/dlq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,100 @@ while (true) {
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const dlq = client.dlq;
await dlq.delete("dlqId");

await client.dlq.delete("dlqId");
```

#### Delete multiple messages from the DLQ

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });

// using an array of dlqIds
const result = await client.dlq.delete(["dlqId-1", "dlqId-2", "dlqId-3"]);

// or using an object with dlqIds
const result2 = await client.dlq.delete({
dlqIds: ["dlqId-1", "dlqId-2", "dlqId-3"],
});

console.log(result.deleted); // number of deleted messages
```

#### Delete DLQ messages with filters

`fromDate` and `toDate` accept a `Date` object or a Unix timestamp in milliseconds.

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });

// delete by label
const result = await client.dlq.delete({ label: "my-label" });

// delete with multiple filters
const result2 = await client.dlq.delete({
url: "https://example.com",
label: "my-label",
fromDate: 1640995200000,
toDate: 1672531200000,
});

// delete all DLQ entries
await client.dlq.delete({ all: true });
```

#### Retry a single message from the DLQ

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });

const result = await client.dlq.retry("dlqId");
```

#### Retry multiple messages from the DLQ

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });

// using an array of dlqIds
const result = await client.dlq.retry(["dlqId-1", "dlqId-2"]);

// or using an object with dlqIds
const result2 = await client.dlq.retry({
dlqIds: ["dlqId-1", "dlqId-2"],
});

console.log(result.responses); // [{ messageId: "..." }, ...]
```

#### Retry DLQ messages with filters

`fromDate` and `toDate` accept a `Date` object or a Unix timestamp in milliseconds.

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });

// retry by label
const result = await client.dlq.retry({ label: "my-label" });

// retry with multiple filters
const result2 = await client.dlq.retry({
url: "https://example.com",
label: "my-label",
fromDate: 1640995200000,
toDate: 1672531200000,
});

// retry all DLQ entries
const result3 = await client.dlq.retry({ all: true });
```
56 changes: 45 additions & 11 deletions qstash/sdks/ts/examples/messages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ for accessing messages that are in the process of being delivered/retried.
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const messages = client.messages
const messages = client.messages;
const msg = await messages.get("msgId");
```

Expand All @@ -22,26 +22,60 @@ const msg = await messages.get("msgId");
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });
const messages = client.messages
const msg = await messages.delete("msgId");

await client.messages.cancel("msgId");
```

#### Cancel messages in bulk

Cancel many messages at once or cancel all messages
Cancel many messages at once or cancel all messages.

```typescript
import { Client } from "@upstash/qstash";

const client = new Client({ token: "<QSTASH_TOKEN>" });

// deleting two messages at once
await client.messages.deleteMany([
"message-id-1",
"message-id-2",
])
// cancel two messages at once
const result = await client.messages.cancel(["message-id-1", "message-id-2"]);

console.log(result.cancelled); // 2

// cancel all messages
const result2 = await client.messages.cancel({ all: true });
console.log(result2.cancelled); // number of cancelled messages
```

#### Cancel messages with filters

Cancel all messages matching specific filters such as `flowControlKey`, `url`, `queueName`, and more.

`fromDate` and `toDate` accept a `Date` object or a Unix timestamp in milliseconds.

```typescript
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.cancel({
flowControlKey: "my-flow-key",
});

console.log(result.cancelled); // number of cancelled messages

// cancel with multiple filters
const result2 = await client.messages.cancel({
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

// deleting all messages
await client.messages.deleteAll()
// cancel all messages regardless of filters
const result3 = await client.messages.cancel({ all: true });
console.log(result3.cancelled); // number of cancelled messages
```
1 change: 1 addition & 0 deletions workflow/basics/client.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The client exposes a set of functions to manage workflow runs and inspect their
- [client.getWaiters](/workflow/basics/client/waiters)
- client.dlq
- [client.dlq.list](/workflow/basics/client/dlq/list)
- [client.dlq.delete](/workflow/basics/client/dlq/delete)
- [client.dlq.restart](/workflow/basics/client/dlq/restart)
- [client.dlq.resume](/workflow/basics/client/dlq/resume)
- [client.dlq.retryFailureFunction](/workflow/basics/client/dlq/callback)
Loading