phpgears/cqrs-async-queue-interop

CQRS 命令总线异步装饰器

0.3 2019-10-01 22:11 UTC

This package is auto-updated.

Last update: 2024-08-25 06:02:52 UTC


README

PHP version Latest Version License

Build Status Style Check Code Quality Code Coverage

Total Downloads Monthly Downloads

Queue-interop 异步 CQRS

Queue-interop 为 CQRS 命令总线提供的异步装饰器

安装

Composer

composer require phpgears/cqrs-async-queue-interop

用法

需要 composer 自动加载文件

require './vendor/autoload.php';

异步命令总线

有关异步命令总线的更多信息,请参阅 phpgears/cqrs-async

use Gears\CQRS\Async\AsyncCommandBus;
use Gears\CQRS\Async\QueueInterop\QueueInteropCommandQueue;
use Gears\CQRS\Async\Serializer\JsonCommandSerializer;
use Gears\CQRS\Async\Discriminator\ParameterCommandDiscriminator;

/* @var \Gears\CQRS\CommandBus $commandBus */
/* @var \Interop\Queue\PsrContext $context */
/* @var \Interop\Queue\PsrDestination $destination */

$commandQueue = new QueueInteropCommandQueue(new JsonCommandSerializer(), $context, $destination);

$asyncCommandBus new AsyncCommandBus(
    $commandBus,
    $commandQueue,
    new ParameterCommandDiscriminator('async')
);

$asyncCommand = new CustomCommand(['async' => true]);

$asyncCommandBus->handle($asyncCommand);

有一些队列互操作实现可用,例如 Enqueue,它支持大量消息队列

贡献

发现了错误或有功能请求? 请新建一个问题。在提交之前,请先查看现有的问题。

查看文件 CONTRIBUTING.md

许可证

有关许可证条款的副本,请参阅源代码中包含的文件 LICENSE