- Define some abstraction on very top level
- EventSourced repository which works with every event store which fulfils the
EventStore
interface - Could be extended by other libraries which provide concrete implementations of event store
- Show how to use it with very simple example
Probably you want to use this library with some spring 2.x. In such case you just need to:
<dependency>
<groupId>io.github.yasiekz</groupId>
<artifactId>event-sourcing-lib</artifactId>
<version>1.1.0</version>
</dependency>
repositories {
mavenCentral()
}
dependencies {
implementation 'io.github.yasiekz:event-sourcing-lib:1.1.0'
}
You just need to create implementation of EventStore
interface. You can search my others repositories looking for
it. I want to create Mongo and MS SQL implementations with SpringData.
@Configuration
public class EventSourcingConfiguration {
@Bean
public EventSourcedRepository<YourEventSourcedAggregate> createRepository(EventStore eventStore) {
return new EventSourcedRepository<>(eventStore) {
@Override
protected YourEventSourcedAggregate createInstance() {
return new YourEventSourcedAggregate();
}
};
}
}
There is an full working example in tests.
./gradlew check