Async decorator for Event Sourcing events and Async Event Bus
composer require phpgears/event-sourcing-async
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
Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before.
See file CONTRIBUTING.md
See file LICENSE included with the source code for a copy of the license terms.