Library to help our apps to be domain event friendly without using EventStore at first., (*1)
, (*2)
Why ?
Because we did not find any library that deal with events in an asynchronous way without EventStore. And domain events are helpful even without EventStore, to start defining boundaries between your bounded contexts., (*3)
Supported event buses
- Symfony Event dispatcher : sync
- Redis : async
Example
See detailled quickstart, (*4)
To run example, (*5)
php examples/redis-worker.php
php examples/quickstart.php
In a fullstack way the best option is to track change in your repository, (*6)
class ORMBookingRepository extends ORMAggregateRootRepository implements BookingRepository
{
public function find($bookingId)
{
$this->getInternalRepository->find($bookingId)
}
public function save(Booking $booking)
{
$this->getManager()->persist($booking);
$this->getManager()->flush();
$this->track($booking);
}
}
$repository = new ORMBookingRepository(
new ManagerRegistry,
'My\FQCN\Booking',
new ChangeTracker(
new LoggerEventBus(
$logger,
new CompositeEventBus([
new SymfonyEventBus($eventDispatcher),
new RedisEventBus($redis, 'booking')
])
)
)
);
EventDispatcher debug
To debug your own event dispatcher with Symfony, we add a CLI for you. You should register it as a service and use the --service-id
option., (*7)