-
-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathCloudTasksConnector.php
More file actions
38 lines (34 loc) · 912 Bytes
/
CloudTasksConnector.php
File metadata and controls
38 lines (34 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
namespace Stackkit\LaravelGoogleCloudTasksQueue;
use Google\Cloud\Tasks\V2\Client\CloudTasksClient;
use Illuminate\Queue\Connectors\ConnectorInterface;
/**
* @phpstan-type QueueConfig array{
* driver: string,
* project: string,
* location: string,
* queue: string,
* app_engine?: bool,
* app_engine_service?: string,
* handler?: string,
* service_account_email?: string,
* backoff?: int,
* dispatch_deadline?: int,
* after_commit?: bool
* }
*/
class CloudTasksConnector implements ConnectorInterface
{
/**
* @param QueueConfig $config
*/
public function connect(array $config): CloudTasksQueue
{
return new CloudTasksQueue(
config: $config,
client: app(CloudTasksClient::class),
dispatchAfterCommit: $config['after_commit'] ?? null
);
}
}