Commit 1c80150
authored
🏗️ refactor(architecture): move events from write slices packages to dedicated one for between slices contracts (#20)
Change caused by LinkedIn discussion:
https://www.linkedin.com/feed/update/urn:li:activity:7295062961356771328?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7295062961356771328%2C7295089102633263104%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287295089102633263104%2Curn%3Ali%3Aactivity%3A7295062961356771328%29
I've given it more thought recently, and indeed events extracted from
slices can be more flexible (to do not couple them to their sourced
command slice, but treat as API between slices).
Especially in cases where the same event can be triggered by two
different commands (although this doesn't happen very frequently).
I have a case in the project, where I think I should refactor handling
the `RecruitCreature`. It should result in two events
`CreatureRecruited` and `AvailableCreaturesChanged` instead of just the
first one. Then in event handlers to reduce available creatures, I will
just handle `AvailableCreaturesChanged` instead of both.
What I would potentially modify is to extract the events separately, as
a contract (system backbone) between slices, while keeping the rest as
it was. The Aggregate and Commands would stay in the write package, as
they're only shared between write slices. Rest API, external consumers
and commands will be also in the same package, do not spread one slice
through "layers" like "domain/application".
Of course, everything I mean in the scope of a single Bounded Context.1 parent e8c0aa3 commit 1c80150
37 files changed
Lines changed: 54 additions & 64 deletions
File tree
- docs/images
- src
- main/java/com/dddheroes/heroesofddd
- armies
- events
- write
- astrologers
- automation
- whenweekstartedthenproclaimweeksymbol
- whenweeksymbolproclaimedthenincreasedwellingavailablecreatures
- events
- write
- calendar
- events
- write
- creaturerecruitment
- automation
- events
- read
- getalldwellings
- write
- resourcespool
- events
- write
- test/java/com/dddheroes/heroesofddd
- armies/write
- astrologers
- automation
- whenweekstartedthenproclaimweeksymbol
- whenweeksymbolproclaimedthenincreasedwellingavailablecreatures
- write/proclaimweeksymbol
- calendar/write
- finishday
- startday
- creaturerecruitment
- automation
- read
- getalldwellings
- getdwellingbyid
- write
- changeavailablecreatures
- recruitcreature
- resourcespool/write
- withdraw
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
Binary file not shown.
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments