定制 acdphp/laravel-sns-sqs-queue 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

acdphp/laravel-sns-sqs-queue

最新稳定版本:v1.0.0

Composer 安装命令:

composer require acdphp/laravel-sns-sqs-queue

包简介

Fanout Laravel queue jobs with AWS SNS and SQS for microservices communication.

README 文档

README

Latest Stable Version

Fanout Laravel queue jobs with AWS SNS and SQS for microservices communication.

workflow

Installation

  1. Install the package

    composer require acdphp/laravel-sns-sqs-queue
  2. Add new queue connection in your config/queue.php. (Similar to default sqs connection but with added endpoint and sns_topic_arn)

    'connections' => [
       ...
       'sns-sqs' => [
          'driver' => 'sns-sqs',
          'key' => env('AWS_ACCESS_KEY_ID'),
          'secret' => env('AWS_SECRET_ACCESS_KEY'),
          'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
          'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
          'queue' => env('SQS_QUEUE', 'default'),
          'suffix' => env('SQS_SUFFIX'),
          'after_commit' => false,
          'endpoint' => env('AWS_ENDPOINT'),
          'sns_topic_arn' => env('SNS_TOPIC_ARN', 'arn:aws:sns:us-east-1:your-account-id:topic'),
      ],
    ]
  3. Usage

    1. Globally set your QUEUE_CONNECTION to sns-sqs
    2. OR Job specific (recommended to only use this for microservice message jobs):
      class MicroserviceMessageJob implements ShouldQueue
      {
          use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
      
          public function __construct($yourData, $anotherData)
          {
              $this->onConnection('sns-sqs');
          }

Notes

  • Fanout Jobs must exist in all applications that should handle the message with the same namespace and constructor arguments for it work properly.
  • Publishing to SNS uses HTTP/S protocol which is synchronous. This means that your job dispatch will hold off the process until the SNS responds back. Consider using a better technology, for instance, using AMQP (like this library) for better performance.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 71
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-26