firevel/cloud-tasks-queue-driver

适用于在Google App Engine上运行的Laravel应用的云任务队列驱动。

0.1.0 2023-04-27 20:53 UTC

This package is auto-updated.

Last update: 2024-09-19 19:48:10 UTC


README

适用于在Google App Engine或Google Cloud Run上运行的Laravel应用的云任务队列驱动。驱动与Firevel和Laravel兼容。

配置

添加到你的config/queue.php

        'cloudtasks' => [
            'driver' => 'cloudtasks',
            'service' => env('GAE_SERVICE'),
            'version' => env('GAE_VERSION'),
            'route' => env('CLOUD_TASKS_ROUTE', '/_cloudtasks'),
            'project' => env('GOOGLE_CLOUD_PROJECT'),
            'location' => env('CLOUD_TASKS_LOCATION', 'us-central1'), // Location must match your App Engine project location.
            'queue_name' => env('CLOUD_TASKS_QUEUE', 'default'),
        ],

QUEUE_CONNECTION设置为cloudtasks,并在你的.env文件中更新CLOUD_TASKS_LOCATION

如果你使用了一个可以覆盖URL的代理或负载均衡器,你可以在队列配置中设置url

云任务设置

使用queue.yamlgcloud了解更多)创建队列。

示例queue.yaml

queue:
- name: default
  rate: 500/s

示例gcloud命令

gcloud tasks queues create default

路由

在App Engine中,路由匹配服务和版本,因此你的任务将始终匹配它被派发的版本。在Cloud Run中,它将始终由提升版本处理。