Skip to content

Latest commit

 

History

History
58 lines (45 loc) · 1.59 KB

README.md

File metadata and controls

58 lines (45 loc) · 1.59 KB

Library to help our apps to be domain event friendly without using EventStore at first.

Build Status

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.

Supported event buses

  • Symfony Event dispatcher : sync
  • Redis : async

Example

See detailled quickstart

To run example

php examples/redis-worker.php
php examples/quickstart.php

In a fullstack way the best option is to track change in your repository

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.