event-engine/prooph-v7-event-store 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

event-engine/prooph-v7-event-store

最新稳定版本:v0.10.3

Composer 安装命令:

composer require event-engine/prooph-v7-event-store

包简介

Event Engine Prooph V7 Event Store Integration

README 文档

README

Event Engine Prooph V7 Event Store Bindings

Installation

composer require event-engine/prooph-v7-event-store

Prooph Binding

tbd

InMemoryEventStore

tbd

FilesystemEventStore

A prooph v7 compatible FilesystemEventStore is included, too. It is meant to be used for demonstration purpose only (for example in a workshop).

//Basic set up that's able to handle Prooph\Common\Messaging\DomainEvent
$filesystemEventStore = new \EventEngine\Prooph\V7\EventStore\FilesystemEventStore(
    'data/prooph.event_store.json', 
    \JSON_PRETTY_PRINT
    // optional MessageFactory -> defaults to FQCNMessageFactory
    // optional MessageConverter -> defaults to NoOpMessageConverter
);

//Create an empty stream
$filesystemEventStore->create(
    new \Prooph\EventStore\Stream(
        new \Prooph\EventStore\StreamName('event_stream'), 
        new ArrayIterator()
    )
);

//Can also be used together with an InMemoryProjectionManager
$projectionManager = new \EventEngine\Prooph\V7\EventStore\Projecting\InMemory\InMemoryProjectionManager(
    $filesystemEventStore,
    new \EventEngine\Persistence\InMemoryConnection()
);

$query = $projectionManager->createQuery();

$query->fromStream('event_stream')
    ->whenAny(function (array $state, \Prooph\Common\Messaging\DomainEvent $event) {
        echo "{$event->messageName()} stored in event_stream\n";
    });

$query->run();

Please Note: The combination of FilesystemEventStore and InMemoryProjectionManager has the drawback that projections only see events that are in the event store at the time of running the projection. If other PHP processes add events to the store, those are first visible for the projection after restarting the PHP process and running the projection again. We might add a FilesystemProjectionManager in the future, if needed.

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-20