Skip to content
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

Apply "module Config pattern" #104

Merged
merged 7 commits into from
Nov 15, 2021
Merged

Apply "module Config pattern" #104

merged 7 commits into from
Nov 15, 2021

Conversation

bartelink
Copy link
Collaborator

@bartelink bartelink commented Nov 5, 2021

This applies a set of code patterns that I've been applying in recent times in a system I'm building that consists of the following elements:

  • the Domain project defines a module Config which defines a Store DU which defines the set of stores its connectable to. This would be Memory plus one or more concrete ones
  • Each module Aggregate has a module Config which surfaces a create method that is passed a Store DU instance and does the appropriate wiring (e.g. if using Cosmos and Snapshots makes sense, it means that logic is close to the aggregate)
  • the Domain project needs to reference the relevant concrete store package e.g. Equinox.CosmosStore. NOTE there should be no logic in the Domain project actually connecting to the store - this is purely to allow one to wire the specific ways the caching or snapshotting needs to work per aggregate in a single place

When Domain is organised in this manner, the following becomes clean to do:
a) define high level tests that operate in-memory which exercise significant workflows in a system (often cross-aggregate), using a Memory Store
b) define integration tests that use the concrete stores
c) define Web host and/or Reactor apps without repeating wiring logic (if it needs to be shared, a .Infrastructure project can have that specific wiring)

A better demo app is needed, and will arrive in due course; for now, the closest thing is the layout of the equinox-shipping project

Includes:

@bartelink bartelink force-pushed the domain-config branch 3 times, most recently from 859704a to 1d50821 Compare November 10, 2021 11:51
@bartelink bartelink marked this pull request as ready for review November 14, 2021 08:05
@bartelink bartelink changed the title Add Domain Configs Apply "module Config pattern" Nov 15, 2021
@bartelink bartelink merged commit 736df9c into master Nov 15, 2021
@bartelink bartelink deleted the domain-config branch November 15, 2021 11:48
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.

None yet

1 participant