1 | <?php |
||
14 | class SqsDriver extends AbstractPrefetchDriver |
||
15 | { |
||
16 | const AWS_SQS_FIFO_SUFFIX = '.fifo'; |
||
17 | const AWS_SQS_EXCEPTION_BAD_REQUEST = 400; |
||
18 | |||
19 | protected $sqs; |
||
20 | protected $queueUrls; |
||
21 | |||
22 | /** |
||
23 | * @param SqsClient $sqs |
||
24 | * @param array $queueUrls |
||
25 | * @param int|null $prefetch |
||
26 | */ |
||
27 | public function __construct(SqsClient $sqs, array $queueUrls = [], $prefetch = null) |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | public function listQueues() |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | * |
||
61 | * @link http://docs.aws.amazon.com/aws-sdk-php/v3/api/api-sqs-2012-11-05.html#createqueue |
||
62 | * |
||
63 | * @return void |
||
64 | * |
||
65 | * @throws SqsException |
||
66 | */ |
||
67 | public function createQueue($queueName) |
||
87 | |||
88 | /** |
||
89 | * @param string $queueName |
||
90 | * |
||
91 | * @return bool |
||
92 | * |
||
93 | * @throws SqsException |
||
94 | */ |
||
95 | private function queueExists($queueName) |
||
112 | |||
113 | /** |
||
114 | * @param string $queueName |
||
115 | * |
||
116 | * @return bool |
||
117 | */ |
||
118 | private function isFifoQueue($queueName) |
||
122 | |||
123 | /** |
||
124 | * @param string $haystack |
||
125 | * @param string $needle |
||
126 | * |
||
127 | * @return bool |
||
128 | */ |
||
129 | private function endsWith($haystack, $needle) |
||
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | public function countMessages($queueName) |
||
157 | |||
158 | /** |
||
159 | * {@inheritdoc} |
||
160 | */ |
||
161 | public function pushMessage($queueName, $message) |
||
177 | |||
178 | /** |
||
179 | * {@inheritdoc} |
||
180 | */ |
||
181 | public function popMessage($queueName, $duration = 5) |
||
205 | |||
206 | /** |
||
207 | * {@inheritdoc} |
||
208 | */ |
||
209 | public function acknowledgeMessage($queueName, $receipt) |
||
218 | |||
219 | /** |
||
220 | * {@inheritdoc} |
||
221 | */ |
||
222 | public function peekQueue($queueName, $index = 0, $limit = 20) |
||
226 | |||
227 | /** |
||
228 | * {@inheritdoc} |
||
229 | * |
||
230 | * @link http://docs.aws.amazon.com/aws-sdk-php/v3/api/api-sqs-2012-11-05.html#deletequeue |
||
231 | */ |
||
232 | public function removeQueue($queueName) |
||
240 | |||
241 | /** |
||
242 | * {@inheritdoc} |
||
243 | */ |
||
244 | public function info() |
||
250 | |||
251 | /** |
||
252 | * AWS works with queue URLs rather than queue names. Returns either queue URL (if queue exists) for given name or null if not. |
||
253 | * |
||
254 | * @param string $queueName |
||
255 | * |
||
256 | * @return mixed |
||
257 | * |
||
258 | * @throws SqsException |
||
259 | */ |
||
260 | protected function resolveUrl($queueName) |
||
274 | } |
||
275 |