File tree Expand file tree Collapse file tree 2 files changed +65
-0
lines changed Expand file tree Collapse file tree 2 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ Yii2 キュー・エクステンション
21
21
* [ AMQP Interop] ( driver-amqp-interop.md )
22
22
* [ Beanstalk] ( driver-beanstalk.md )
23
23
* [ Gearman] ( driver-gearman.md )
24
+ * [ AWS SQS] ( driver-sqs.md )
24
25
25
26
開発ツール
26
27
----------
Original file line number Diff line number Diff line change
1
+ AWS SQS ドライバ
2
+ ================
3
+
4
+ このドライバはキューのデータを保存するのに AWS SQS を使います。
5
+
6
+ これを使用するためには、あなたのアプリケーションに ` aws/aws-sdk-php ` エクステンションを追加する必要があります。
7
+
8
+ 構成例:
9
+
10
+ ``` php
11
+ return [
12
+ 'bootstrap' => [
13
+ 'queue', // コンポーネントが自身のコンソール・コマンドを登録します
14
+ ],
15
+ 'components' => [
16
+ 'queue' => [
17
+ 'class' => \yii\queue\sqs\Queue::class,
18
+ 'url' => '<sqs url >',
19
+ 'key' => '<key >',
20
+ 'secret' => '<secret >',
21
+ 'region' => '<region >',
22
+ ],
23
+ ],
24
+ ];
25
+ ```
26
+
27
+ コンソール
28
+ ----------
29
+
30
+ タスクを実行するためにコンソール・コマンドが使用されます。
31
+
32
+ ``` sh
33
+ yii queue/listen [timeout]
34
+ ```
35
+
36
+ ` listen ` コマンドが無限にキューを調べ続けるデーモンを起動します。キューに新しいタスクがあると、即座に取得され、実行されます。
37
+ ` timeout ` パラメータはジョブを待つ秒数を指定するものです。
38
+ デーモンは、クライアントとキューの間の接続を保持する SQS の "Long Polling" 機能を使います。
39
+
40
+ ** 重要** SQS ドライバの ` timeout ` パラメータは 0 から 20 秒の範囲内になければなりません。
41
+
42
+ このコマンドを [ supervisor] ( worker.md#supervisor ) または [ systemd] ( worker.md#systemd ) によって適切にデーモン化するのが、
43
+ 最も効率的な方法です。
44
+
45
+ ``` sh
46
+ yii queue/run
47
+ ```
48
+
49
+ ` run ` コマンドは、キューが空になるまでループして、タスクを取得し、実行します。
50
+ [ cron] ( worker.md#cron ) に向いた方法です。
51
+
52
+ ` run ` および ` listen ` のコマンドは下記のオプションを持っています。
53
+
54
+ - ` --verbose ` , ` -v ` : 実行の状態をコンソールに表示します。
55
+ - ` --isolate ` : ジョブ実行の饒舌モード。有効な場合、各ジョブの実行結果が表示されます。
56
+ - ` --color ` : 饒舌モードでハイライトを有効にします。
57
+
58
+ ``` sh
59
+ yii queue/clear
60
+ ```
61
+
62
+ ` clear ` コマンドはキューをクリアします。
63
+
64
+
You can’t perform that action at this time.
0 commit comments