Uses of Interface
dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.StatefulAggregate
-
-
Uses of StatefulAggregate in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful
Classes in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful with type parameters of type StatefulAggregate Modifier and Type Interface Description interfaceStatefulAggregate<ID,EVENT_TYPE,AGGREGATE_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_TYPE>>interfaceStatefulAggregateRepository<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>>OpinionatedAggregateRepository that's built to persist and load a specificStatefulAggregatetype in combination withEventStore,UnitOfWorkFactoryand aStatefulAggregateInstanceFactory.
You can use theStatefulAggregateRepository.from(ConfigurableEventStore, AggregateEventStreamConfiguration, StatefulAggregateInstanceFactory, Class)to create a newStatefulAggregateRepositoryinstance that supports the most common repository method.
Alternatively you can extend from theStatefulAggregateRepository.DefaultStatefulAggregateRepositoryand add your own special methodsstatic classStatefulAggregateRepository.DefaultStatefulAggregateRepository<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>>DefaultStatefulAggregateRepositoryimplementation.Methods in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful with type parameters of type StatefulAggregate Modifier and Type Method Description static <CONFIG extends dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.persistence.AggregateEventStreamConfiguration,ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>>
StatefulAggregateRepository<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>StatefulAggregateRepository. from(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.ConfigurableEventStore<CONFIG> eventStore, CONFIG eventStreamConfiguration, StatefulAggregateInstanceFactory aggregateRootInstanceFactory, Class<AGGREGATE_IMPL_TYPE> aggregateImplementationType)Create anStatefulAggregateRepositoryinstance that supports loading and persisting the given Aggregate type - theEventStorewill be configured with the suppliedeventStreamConfiguration.
This factory method will try to resolve the Aggregate Id type from the aggregateImplementationType type parameters
If that fails please useStatefulAggregateRepository.from(ConfigurableEventStore, AggregateEventStreamConfiguration, StatefulAggregateInstanceFactory, Class, Class)static <CONFIG extends dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.persistence.AggregateEventStreamConfiguration,ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>>
StatefulAggregateRepository<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>StatefulAggregateRepository. from(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.ConfigurableEventStore<CONFIG> eventStore, CONFIG eventStreamConfiguration, StatefulAggregateInstanceFactory aggregateRootInstanceFactory, Class<AGGREGATE_IMPL_TYPE> aggregateImplementationType, AggregateSnapshotRepository aggregateSnapshotRepository)Create anStatefulAggregateRepositoryinstance that supports loading and persisting the given Aggregate type - theEventStorewill be configured with the suppliedeventStreamConfiguration.
This factory method will try to resolve the Aggregate Id type from the aggregateImplementationType type parameters
If that fails please useStatefulAggregateRepository.from(ConfigurableEventStore, AggregateEventStreamConfiguration, StatefulAggregateInstanceFactory, Class, Class)static <CONFIG extends dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.persistence.AggregateEventStreamConfiguration,ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>>
StatefulAggregateRepository<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>StatefulAggregateRepository. from(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.ConfigurableEventStore<CONFIG> eventStore, CONFIG eventStreamConfiguration, StatefulAggregateInstanceFactory aggregateRootInstanceFactory, Class<ID> aggregateIdType, Class<AGGREGATE_IMPL_TYPE> aggregateImplementationType)Create anStatefulAggregateRepositoryinstance that supports loading and persisting the given Aggregate type - theEventStorewill be configured with the suppliedeventStreamConfigurationstatic <CONFIG extends dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.persistence.AggregateEventStreamConfiguration,ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>>
StatefulAggregateRepository<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>StatefulAggregateRepository. from(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.ConfigurableEventStore<CONFIG> eventStore, CONFIG eventStreamConfiguration, StatefulAggregateInstanceFactory aggregateRootInstanceFactory, Class<ID> aggregateIdType, Class<AGGREGATE_IMPL_TYPE> aggregateImplementationType, AggregateSnapshotRepository aggregateSnapshotRepository)Create anStatefulAggregateRepositoryinstance that supports loading and persisting the given Aggregate type - theEventStorewill be configured with the suppliedeventStreamConfigurationstatic <CONFIG extends dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.persistence.AggregateEventStreamConfiguration,ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>>
StatefulAggregateRepository<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>StatefulAggregateRepository. from(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.ConfigurableEventStore<CONFIG> eventStore, dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, StatefulAggregateInstanceFactory aggregateRootInstanceFactory, Class<AGGREGATE_IMPL_TYPE> aggregateImplementationType)Create anStatefulAggregateRepositoryinstance that supports loading and persisting the given Aggregate type - if missing, theEventStorewill be configured with the defaultAggregateEventStreamConfigurationbased on theAggregateEventStreamConfigurationFactorythat theEventStore'sAggregateEventStreamPersistenceStrategyis configured with
This factory method will try to resolve the Aggregate Id type from the aggregateImplementationType type parameters
If that fails please useStatefulAggregateRepository.from(ConfigurableEventStore, AggregateEventStreamConfiguration, StatefulAggregateInstanceFactory, Class, Class)static <CONFIG extends dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.persistence.AggregateEventStreamConfiguration,ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>>
StatefulAggregateRepository<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>StatefulAggregateRepository. from(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.ConfigurableEventStore<CONFIG> eventStore, dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, StatefulAggregateInstanceFactory aggregateRootInstanceFactory, Class<AGGREGATE_IMPL_TYPE> aggregateImplementationType, AggregateSnapshotRepository aggregateSnapshotRepository)Create anStatefulAggregateRepositoryinstance that supports loading and persisting the given Aggregate type - if missing, theEventStorewill be configured with the defaultAggregateEventStreamConfigurationbased on theAggregateEventStreamConfigurationFactorythat theEventStore'sAggregateEventStreamPersistenceStrategyis configured with
This factory method will try to resolve the Aggregate Id type from the aggregateImplementationType type parameters
If that fails please useStatefulAggregateRepository.from(ConfigurableEventStore, AggregateEventStreamConfiguration, StatefulAggregateInstanceFactory, Class, Class)static <CONFIG extends dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.persistence.AggregateEventStreamConfiguration,ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>>
StatefulAggregateRepository<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>StatefulAggregateRepository. from(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.ConfigurableEventStore<CONFIG> eventStore, dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, StatefulAggregateInstanceFactory aggregateRootInstanceFactory, Class<ID> aggregateIdType, Class<AGGREGATE_IMPL_TYPE> aggregateImplementationType)Create anStatefulAggregateRepositoryinstance that supports loading and persisting the given Aggregate type - if missing, theEventStorewill be configured with the defaultAggregateEventStreamConfigurationbased on theAggregateEventStreamConfigurationFactorythat theEventStore'sAggregateEventStreamPersistenceStrategyis configured withstatic <CONFIG extends dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.persistence.AggregateEventStreamConfiguration,ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE extends StatefulAggregate<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>>
StatefulAggregateRepository<ID,EVENT_TYPE,AGGREGATE_IMPL_TYPE>StatefulAggregateRepository. from(dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.ConfigurableEventStore<CONFIG> eventStore, dk.cloudcreate.essentials.components.eventsourced.eventstore.postgresql.eventstream.AggregateType aggregateType, StatefulAggregateInstanceFactory aggregateRootInstanceFactory, Class<ID> aggregateIdType, Class<AGGREGATE_IMPL_TYPE> aggregateImplementationType, AggregateSnapshotRepository aggregateSnapshotRepository)Create anStatefulAggregateRepositoryinstance that supports loading and persisting the given Aggregate type - if missing, theEventStorewill be configured with the defaultAggregateEventStreamConfigurationbased on theAggregateEventStreamConfigurationFactorythat theEventStore'sAggregateEventStreamPersistenceStrategyis configured with -
Uses of StatefulAggregate in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.classic
Classes in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.classic that implement StatefulAggregate Modifier and Type Class Description classAggregateRoot<ID,EVENT_TYPE extends Event<ID>,AGGREGATE_TYPE extends AggregateRoot<ID,EVENT_TYPE,AGGREGATE_TYPE>>A specialized and opinionated mutableAggregatedesign
ThisAggregateRootis designed to work with Class based Event's that inherit fromEvent.
This design is deliberate and will manage a lot of things for you as a developer at the cost of some flexibility. -
Uses of StatefulAggregate in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.classic.state
Classes in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.classic.state that implement StatefulAggregate Modifier and Type Class Description classAggregateRootWithState<ID,EVENT_TYPE extends Event<ID>,STATE extends AggregateState<ID,EVENT_TYPE>,AGGREGATE_TYPE extends AggregateRootWithState<ID,EVENT_TYPE,STATE,AGGREGATE_TYPE>>Variant of theAggregateRootpattern where the aggregate's state and allEventHandlerannotated methods are placed within the concreteAggregateStateobject.
When theAggregateRootWithStateis combined withAggregateState, then theAggregateRootWithStatewill contain the command methods and theAggregateStatecontains the state fields and theEventHandlerannotated methods. -
Uses of StatefulAggregate in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern
Classes in dk.cloudcreate.essentials.components.eventsourced.aggregates.stateful.modern that implement StatefulAggregate Modifier and Type Class Description classAggregateRoot<ID,EVENT_TYPE,AGGREGATE_TYPE extends AggregateRoot<ID,EVENT_TYPE,AGGREGATE_TYPE>>A modern opinionated interpretation of the classicAggregateRootdesign, where theEvent's are mutable.
The modern interpretation doesn't specify any requirement on the design of the Events, they can be Java 17+ records or simple POJO's.
Note: TheAggregateRootworks best in combination with theStatefulAggregateRepositorythat's configured to use theStatefulAggregateInstanceFactory.reflectionBasedAggregateRootFactory(), because theAggregateRootneeds to be provided its aggregated id through theAggregateRoot(Object)constructor!
The modernAggregateRootsupports keeping the state projection andEventHandlerannotated methods within theAggregateRootinstance or within anAggregateStateinstance.
If you wish to keep the state projection andEventHandlerannotated methods within anAggregateStateinstance, then you only need to implement theWithStateinterface:
-