simplesoftwareio/simple-sqs-extended-client

此包已被废弃且不再维护。作者建议使用 defectivecode/laravel-sqs-extended 包。

Simple SQS Extended Client 是一个支持超过 256kb 扩展有效载荷的 SQS 驱动器,适用于 Laravel。

2.0.2 2023-03-29 13:23 UTC

This package is auto-updated.

Last update: 2024-06-04 18:18:50 UTC


README

该包已迁移到 https://github.com/DefectiveCode/laravel-sqs-extended。请阅读迁移指南并相应更新您的项目。

简介

Simple SQS Extended Client 是一个 Laravel 队列驱动器,旨在绕过 AWS SQS 256KB 有效载荷大小限制。此队列驱动器将自动将大有效载荷序列化到磁盘(通常是 S3),然后在运行时反序列化。

支持

您可以通过发送邮件到 support@simplesoftware.io 请求专业支持。所有支持请求需要每小时 200 美元的费用。所有其他支持将由开源社区提供。

安装

  1. 首先创建一个磁盘,用于存储您所有的大 SQS 有效载荷。

我们强烈建议您在存储 SQS 有效载荷时使用 私有 存储桶。有效载荷可能包含敏感信息,不应公开共享。

  1. 运行 composer require simplesoftwareio/simple-sqs-extended-client "~1" 安装队列驱动器。

  2. 然后,将以下默认队列设置添加到您的 queue.php 文件中。

Laravel Vapor 用户必须将连接名称设置为 sqs。Vapor Core 中查找 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',
      ],
  ],
  1. 启动您的队列,享受无需担心 SQS 的 256KB 限制的乐趣 :)