Skip to content

🏗️ refactor(architecture): move events from write slices packages to dedicated one for between slices contracts #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

MateuszNaKodach
Copy link
Owner

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.

@MateuszNaKodach MateuszNaKodach changed the title ♻️ refactor: move events from write slices packages to dedicated one for between slices contracts ♻️ refactor(architecture): move events from write slices packages to dedicated one for between slices contracts Feb 19, 2025
@MateuszNaKodach MateuszNaKodach changed the title ♻️ refactor(architecture): move events from write slices packages to dedicated one for between slices contracts 🏗️ refactor(architecture): move events from write slices packages to dedicated one for between slices contracts Feb 19, 2025
@MateuszNaKodach MateuszNaKodach merged commit 1c80150 into master Feb 19, 2025
1 check passed
@MateuszNaKodach MateuszNaKodach deleted the refactor/events-package branch February 19, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant