Skip to content

Commit 3400290

Browse files
committed
Replace onConnection with onPool in async queue docs
Updated documentation to use the onPool method instead of onConnection for specifying queue connections, reflecting API changes and improving consistency in examples and method descriptions.
1 parent 718a2f7 commit 3400290

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/zh-hk/components/async-queue-closure-job.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use function FriendsOfHyperf\AsyncQueueClosureJob\dispatch;
5151
dispatch(function () {
5252
// 你的任務邏輯
5353
})
54-
->onConnection('high-priority') // 指定隊列連接
54+
->onPool('high-priority') // 指定隊列連接
5555
->delay(60) // 延遲 60 秒執行
5656
->setMaxAttempts(5); // 最多重試 5 次
5757
```
@@ -66,7 +66,7 @@ use function FriendsOfHyperf\AsyncQueueClosureJob\dispatch;
6666
// 使用指定的隊列連接
6767
dispatch(function () {
6868
// 高優先級任務邏輯
69-
})->onConnection('high-priority');
69+
})->onPool('high-priority');
7070

7171
// 或者使用 onPool 方法(別名)
7272
dispatch(function () {
@@ -106,7 +106,7 @@ dispatch(function () {
106106
// 你的任務邏輯
107107
})
108108
->when($isUrgent, function ($dispatch) {
109-
$dispatch->onConnection('urgent');
109+
$dispatch->onPool('urgent');
110110
});
111111

112112
// 僅當條件為 false 時執行回調
@@ -122,7 +122,7 @@ dispatch(function () {
122122
// 你的任務邏輯
123123
})
124124
->when($isUrgent, function ($dispatch) {
125-
$dispatch->onConnection('urgent');
125+
$dispatch->onPool('urgent');
126126
})
127127
->unless($isUrgent, function ($dispatch) {
128128
$dispatch->delay(60);
@@ -200,7 +200,7 @@ use function FriendsOfHyperf\AsyncQueueClosureJob\dispatch;
200200
dispatch(function (StatisticsService $stats) use ($date) {
201201
$stats->calculateDailyReport($date);
202202
$stats->sendReport($date);
203-
})->onConnection('statistics');
203+
})->onPool('statistics');
204204
```
205205

206206
### 批量操作
@@ -231,7 +231,7 @@ foreach ($userIds as $userId) {
231231

232232
### `PendingAsyncQueueDispatch` 方法
233233

234-
#### `onConnection(string $connection): static`
234+
#### `onPool(string $connection): static`
235235

236236
設置隊列連接名稱。
237237

@@ -243,7 +243,7 @@ foreach ($userIds as $userId) {
243243

244244
#### `onPool(string $pool): static`
245245

246-
設置隊列連接名稱(`onConnection` 的別名)。
246+
設置隊列連接名稱(`onPool` 的別名)。
247247

248248
**參數:**
249249
- `$pool` - 隊列連接名稱

0 commit comments

Comments
 (0)