https://github.com/monteiro/symfonycon-winter-2021
domain events application demo
https://github.com/monteiro/symfonycon-winter-2021
Last synced: about 1 year ago
JSON representation
domain events application demo
- Host: GitHub
- URL: https://github.com/monteiro/symfonycon-winter-2021
- Owner: monteiro
- Created: 2021-11-15T09:00:50.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-23T15:45:43.000Z (over 2 years ago)
- Last Synced: 2025-03-24T23:31:21.943Z (about 1 year ago)
- Language: PHP
- Size: 145 KB
- Stars: 17
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SymfonyWorld Winter Edition 2021
This project is a demo from the presentation of Hugo Monteiro at SymfonyWorld Winter edition 2021:
["Decoupling your application using Symfony Messenger and events"](https://live.symfony.com/2021-world-winter/schedule#session-606)
## Setup the application
```
composer install
bin/console doctrine:migrations:migrate
bin/console doctrine:fixtures:load
// create a customer, car and reservation and cancel it
bin/console app:rentcar:simulation -vvv
// get domain events from the database (from the stored_event table) and push to the transport (outbox) - infinite loop
bin/console app:domain:events:publish -vvv
// consume domain events in another handler using the transport
bin/console messenger:consume async
```
_Note: The transport configured is the doctrine one, so the sqlite database will be used by default._
## Run unit tests
```
bin/phpunit -c phpunit.xml.dist
```
## What should you expect?
- Domain events in a table "stored_event" after executing the "simulation" command
- Aggregate roots in their tables (e.g. customer, reservation, etc)
- Worker that sends the domain events from the database to the transport configured
- Use Symfony Messenger consume command to consume domain events published
## Work in progress
- API with all the handler actions and API tests
- Create more tests to cover all invariants