定制 win-local-inc/message-bus 二次开发

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

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

win-local-inc/message-bus

最新稳定版本:3.0.4

Composer 安装命令:

composer require win-local-inc/message-bus

包简介

A package for message bus.

关键字:

README 文档

README

Installation

  • PHP 8.1 is required

  • remove sqs-sns from config/queue.php, it will be added by provider, or update it with

'sqs-sns' => [
        'driver' => 'sqs-sns',
        'key' => env('AWS_SQS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SQS_SECRET_ACCESS_KEY'),
        'queue' => env('AWS_SQS_QUEUE', 'your-queue-url'),
        'region' => env('AWS_SQS_REGION', 'us-east-2'),
        'topic' => env('AWS_SNS_TOPIC'),
        'routes' => [
            env('AWS_SNS_TOPIC') => 'WinLocal\\MessageBus\\Jobs\\SqsGetJob',
        ],
        'version' => 'latest',
        'ua_append' => [
            'L5MOD/'.\Aws\Laravel\AwsServiceProvider::VERSION,
        ],
    ],
  • add envs :
AWS_SQS_HANDLER_PATHS= app paths to handlers separeted by "," resolved by App::path($path)
AWS_SQS_VALIDATOR_PATHS= app paths to validators separeted by "," resolved by App::path($path)
AWS_SQS_ACCESS_KEY_ID=
AWS_SQS_SECRET_ACCESS_KEY=
AWS_SQS_REGION=us-east-2
AWS_SQS_QUEUE=
AWS_SNS_TOPIC=
  • handlers:

There are two ways to implement handlers

  1. Standard Laravel Job see -> WinLocal\MessageBus\Tests\Data\Handlers\AdvertCreated.php
  2. Interface WinLocal\MessageBus\Contracts\ExecutorInterface see -> WinLocal\MessageBus\Tests\Data\Handlers\AudienceCreated.php

Attribute WinLocal\MessageBus\Attributes\HandleSubjects needs to be used, so resolver will use it.

  • validators:

There is optional validator available, that will be excecuted before handlers. Validator needs to extend WinLocal\MessageBus\Contracts\AbstractExecutorValidator see -> WinLocal\MessageBus\Tests\Data\Validators\AudienceCreated.php

  • push notification:
WinLocal\MessageBus\Jobs\SnsSendJob::dispatch(\WinLocal\MessageBus\Enums\Subject $subject, array $message);
  • each service needs to run supervisor

php artisan queue:work sqs-sns --max-jobs=100 --tries=3 --max-time=3600

  • to run tests on package

vendor/bin/testbench package:test --configuration=tests/phpunit.xml

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-15