sbagroupzrt / simple-sqs-extended-client
Simple SQS Extended Client 是一个支持超过 256KB 扩展有效载荷的 SQS 驱动程序,用于 Laravel。
1.10
2022-11-08 08:22 UTC
Requires
- php: >=7.1
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~5.0
Suggests
- laravel/vapor-core: Allows SQS disk based storage while using Laravel Vapor.
README
简介
Simple SQS Extended Client 是一个 Laravel 队列驱动程序,旨在解决 AWS SQS 256KB 有效载荷大小限制的问题。此队列驱动程序将自动将大有效载荷序列化到磁盘(通常是 S3),然后在运行时反序列化。
支持
您可以通过发送电子邮件至 support@simplesoftware.io 请求专业支持。所有支持请求均需支付每小时 200 美元的服务费。其他支持将由开源社区提供。
安装
- 首先创建一个磁盘,用于存储所有大 SQS 有效载荷。
我们强烈建议您在存储 SQS 有效载荷时使用 私有 存储桶。有效载荷可能包含敏感信息,不应公开共享。
-
运行
composer require simplesoftwareio/simple-sqs-extended-client "~1"
安装队列驱动程序。 -
然后,将以下默认队列设置添加到您的
queue.php
文件中。
Laravel Vapor 用户必须将连接名称设置为
sqs
。Vapor 核心中查找sqs
连接,如果使用其他连接名称,则此库将无法按预期工作。
/*
|--------------------------------------------------------------------------
| SQS Disk Queue Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the SQS disk queue driver. It shares all of the same
| configuration options from the built in Laravel SQS queue driver. The only added
| option is `disk_options` which are explained below.
|
| always_store: Determines if all payloads should be stored on a disk regardless if they are over SQS's 256KB limit.
| cleanup: Determines if the payload files should be removed from the disk once the job is processed. Leaveing the
| files behind can be useful to replay the queue jobs later for debugging reasons.
| disk: The disk to save SQS payloads to. This disk should be configured in your Laravel filesystems.php config file.
| prefix The prefix (folder) to store the payloads with. This is useful if you are sharing a disk with other SQS queues.
| Using a prefix allows for the queue:clear command to destroy the files separately from other sqs-disk backed queues
| sharing the same disk.
|
*/
'sqs' => [
'driver' => 'sqs-disk',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
'disk_options' => [
'always_store' => false,
'cleanup' => false,
'disk' => env('SQS_DISK'),
'prefix' => 'bucket-prefix',
],
],
- 启动您的队列并从中获利,无需担心 SQS 的 256KB 限制 :)