1 | <?php |
||
13 | class AmazonSqsDriver implements DriverInterface |
||
14 | { |
||
15 | use MaxItemsTrait; |
||
16 | use RestartTrait; |
||
17 | use SerializerAwareTrait; |
||
18 | |||
19 | /** |
||
20 | * @var SqsClient |
||
21 | */ |
||
22 | private $client; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $queueName; |
||
28 | |||
29 | /** |
||
30 | * string |
||
31 | */ |
||
32 | private $queueUrl; |
||
33 | |||
34 | /** |
||
35 | * integer |
||
36 | */ |
||
37 | private $sleepInterval = 0; |
||
38 | |||
39 | /** |
||
40 | * Create new Amazon SQS driver. |
||
41 | * |
||
42 | * You have to create aws client instnace and provide it to this driver. |
||
43 | * You can use service builder or factory method. |
||
44 | * |
||
45 | * <code> |
||
46 | * use Aws\Sqs\SqsClient; |
||
47 | * |
||
48 | * $client = SqsClient::factory(array( |
||
49 | * 'profile' => '<profile in your aws credentials file>', |
||
50 | * 'region' => '<region name>' |
||
51 | * )); |
||
52 | * </code> |
||
53 | * |
||
54 | * or |
||
55 | * |
||
56 | * <code> |
||
57 | * use Aws\Common\Aws; |
||
58 | * |
||
59 | * // Create a service builder using a configuration file |
||
60 | * $aws = Aws::factory('/path/to/my_config.json'); |
||
61 | * |
||
62 | * // Get the client from the builder by namespace |
||
63 | * $client = $aws->get('Sqs'); |
||
64 | * </code> |
||
65 | * |
||
66 | * More examples see: https://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-sqs.html |
||
67 | * |
||
68 | * |
||
69 | * @see examples/sqs folder |
||
70 | * |
||
71 | * @param SqsClient $client |
||
72 | * @param string $queueName |
||
73 | * @param array $queueAttributes |
||
74 | */ |
||
75 | public function __construct(SqsClient $client, string $queueName, array $queueAttributes = []) |
||
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | public function send(MessageInterface $message, int $priority = Dispatcher::PRIORITY_MEDIUM): bool |
||
100 | |||
101 | public function setupPriorityQueue(string $name, int $priority): void |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | public function wait(Closure $callback, array $priorities = []): void |
||
145 | } |
||
146 |