johanhaleby / occurrent

Unintrusive Event Sourcing Library for the JVM
https://occurrent.org
120 stars 16 forks source link

ModuleDSL definition #123

Open johanhaleby opened 1 year ago

johanhaleby commented 1 year ago

It would be good to differentiate between an initialized module and a ModuleDefintion. E.g. this would be nice:

val moduleDefinition = module(name = "something") {
    commands {
      ...
    }
    sagas {
      ...
    }
    policies/triggers {
      ...
    }
}

moduleDefinition.initialize(eventStore, subscriptionModel, domainQueries, ...)

ModuleDefinition is just data which means that it's easier to compose. Note that it must be possible to compose modules and not only module definitons, since for certain modules you may want different event store implementations or subscription models etc.