This directory contains test assets that form a small event-sourcing functioning code example.
It is designed to demonstrate how to implement common business logic scenarios through the
facilities of the EventSourcingWorkshop\EventSourcing
component.
You can take the code from this directory, and use it as a blueprint for future business scenarios, after having properly event-stormed them.
Greeting
, which is an event-sourced aggregate:- created by firing
SayHello
- terminated by a
SayGoodbye
- created by firing
- domain events raised by interacting with
Greeting
: - a
WhenHelloSaidThenSayGoodbye
policy- processed via
bin/console messenger:consume event_sourcing_process_manager
- processed via
- a
projection_date_of_last_dispensed_greeting
table:- declared by a db migration
- populated by
DateOfLastDispensedGreeting
projector - processed via
bin/console messenger:consume projection_date_of_last_dispensed_greeting
- a
projection_pending_goodbyes
table:- declared by a db migration
- populated by
PendingGoodbyes
projector - processed via
bin/console messenger:consume projection_pending_goodbyes
graph TB
subgraph Frontend
Controller((Controller))
end
subgraph CommandBus
Controller --> SayHello(SayHello)
Controller --> SayGoodbye(SayGoodbye)
end
subgraph Aggregates
SayHello --> Greeting{Greeting}
SayGoodbye --> Greeting{Greeting}
end
subgraph EventStore
Greeting --> HelloSaid>HelloSaid]
Greeting --> GoodbyeSaid>GoodbyeSaid]
end
subgraph Projectors
PendingGoodbyes[PendingGoodbyes]
HelloSaid --> PendingGoodbyes
GoodbyeSaid --> PendingGoodbyes
HelloSaid --> DateOfLastDispensedGreeting[DateOfLastDispensedGreeting]
end
subgraph Projections/Read Models
PendingGoodbyes -.-> projection_pending_goodbyes
DateOfLastDispensedGreeting -.-> projection_date_of_last_dispensed_greeting
end
subgraph Policies
HelloSaid --> WhenHelloSaidThenSayGoodbye[WhenHelloSaidThenSayGoodbye]
WhenHelloSaidThenSayGoodbye --> SayGoodbye
end