1 | <?php |
||
14 | class SqsDriver extends AbstractPrefetchDriver |
||
15 | { |
||
16 | const AWS_SQS_FIFO_SUFFIX = '.fifo'; |
||
17 | |||
18 | protected $sqs; |
||
19 | protected $queueUrls; |
||
20 | |||
21 | /** |
||
22 | * @param SqsClient $sqs |
||
23 | * @param array $queueUrls |
||
24 | * @param int|null $prefetch |
||
25 | */ |
||
26 | public function __construct(SqsClient $sqs, array $queueUrls = [], $prefetch = null) |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | public function listQueues() |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | * |
||
60 | * @link http://docs.aws.amazon.com/aws-sdk-php/v3/api/api-sqs-2012-11-05.html#createqueue |
||
61 | */ |
||
62 | public function createQueue($queueName) |
||
82 | |||
83 | /** |
||
84 | * @param string $queueName |
||
85 | * |
||
86 | * @return bool |
||
87 | */ |
||
88 | private function isFifoQueue($queueName) |
||
92 | |||
93 | /** |
||
94 | * @param string $haystack |
||
95 | * @param string $needle |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | private function endsWith($haystack, $needle) |
||
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | public function countMessages($queueName) |
||
127 | |||
128 | /** |
||
129 | * {@inheritdoc} |
||
130 | */ |
||
131 | public function pushMessage($queueName, $message) |
||
147 | |||
148 | /** |
||
149 | * {@inheritdoc} |
||
150 | */ |
||
151 | public function popMessage($queueName, $duration = 5) |
||
175 | |||
176 | /** |
||
177 | * {@inheritdoc} |
||
178 | */ |
||
179 | public function acknowledgeMessage($queueName, $receipt) |
||
188 | |||
189 | /** |
||
190 | * {@inheritdoc} |
||
191 | */ |
||
192 | public function peekQueue($queueName, $index = 0, $limit = 20) |
||
196 | |||
197 | /** |
||
198 | * {@inheritdoc} |
||
199 | * |
||
200 | * @link http://docs.aws.amazon.com/aws-sdk-php/v3/api/api-sqs-2012-11-05.html#deletequeue |
||
201 | */ |
||
202 | public function removeQueue($queueName) |
||
210 | |||
211 | /** |
||
212 | * {@inheritdoc} |
||
213 | */ |
||
214 | public function info() |
||
220 | |||
221 | /** |
||
222 | * AWS works with queue URLs rather than queue names. Returns either queue URL (if queue exists) for given name or null if not. |
||
223 | * |
||
224 | * @param string $queueName |
||
225 | * |
||
226 | * @return mixed |
||
227 | * |
||
228 | * @throws SqsException |
||
229 | */ |
||
230 | protected function resolveUrl($queueName) |
||
244 | } |
||
245 |