prooph / event-sourcing

Provides basic functionality for event sourced aggregates.
http://getprooph.org
BSD 3-Clause "New" or "Revised" License
265 stars 41 forks source link

Multiple Event Handlers #28

Closed guyradford closed 8 years ago

guyradford commented 8 years ago

I have been studying and playing with the code for a bit and cant see a way to add multiple event handlers. Each AggregateRoot contains its own Event handlers (eg whenUserWasRenamed). Part of the spec for CQRS-ES is that you can have multiple read models. I create a new AggregateRoot that had the same event listeners but the AggregateRoot failed to create and only returned null.

What am i missing?

Thank you

prolic commented 8 years ago

in the configuration of the event store, you need to add the event publisher plugin, like this:

return [
    'prooph' => [
        'event_store' => [
            'plugins' => [
                 \Prooph\EventStoreBusBridge\EventPublisher::class,

This will publish all domain events that happened in your aggregates to the event bus. In the event bus you can route events to event listeners (or send them to rabbitmq to handle the events async).

prolic commented 8 years ago

For more about this: check the documentation or visit us at https://gitter.im/prooph/improoph

guyradford commented 8 years ago

The docs are a little vague ;) Thank you Ill go look at https://gitter.im/prooph/improoph, I guess the google ground is dead? you still have links to it around the place.

prolic commented 8 years ago

we try to visit the google group from time to time, but we have a good community in the gitter chat

you can also check out our sample app at: https://github.com/prooph/proophessor-do

This will help you to get started.

guyradford commented 8 years ago

I totally missed proophessor-do, thank you.