Skip to content

Bridge event-sourcing AggregateEvent with event-async AsyncEventBus

License

Notifications You must be signed in to change notification settings

phpgears/event-sourcing-async

Repository files navigation

PHP version Latest Version License

Build Status Style Check Code Quality Code Coverage

Total Downloads Monthly Downloads

Event Sourcing Async

Async decorator for Event Sourcing events and Async Event Bus

Installation

Composer

composer require phpgears/event-sourcing-async

Usage

Require composer autoload file

require './vendor/autoload.php';

This package adds a new Gears\EventSourcing\Async\Serializer\JsonEventSerializer serializer, as a general serializer allowing maximum compatibility in case of events being handled by other systems, to allow Gears\EventSourcing\Event\AggregateEvent events to be used in Async event bus

use Gears\Event\Async\AsyncEventBus;
use Gears\EventSourcing\Async\Serializer\JsonEventSerializer;
use Gears\Event\Async\Discriminator\ParameterEventDiscriminator;

/* @var \Gears\Event\EventBus $eventBus */

/* @var Gears\Event\Async\EventQueue $eventQueue */
$eventQueue = new CustomEventQueue(new JsonEventSerializer());

$asyncEventBus new AsyncEventBus(
    $eventBus,
    $eventQueue,
    new ParameterEventDiscriminator('async')
);

$asyncEvent = new CustomEvent(['async' => true]);

$asyncEventBus->dispatch($asyncEvent);

Refer to phpgears/event-async for more information

Contributing

Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before.

See file CONTRIBUTING.md

License

See file LICENSE included with the source code for a copy of the license terms.

About

Bridge event-sourcing AggregateEvent with event-async AsyncEventBus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages