Hi
I am experimenting with mapDb as eventStorageEngine … the implementation stays a java collection, but it can be stored on file system -> http://www.mapdb.org/.
this is an early draft: https://github.com/toolisticon/axon-extensions/blob/master/axon-mapdb/src/main/kotlin/MapDbEventstorageEngine.kt
used like this:
fun main(args: Array<String>) {
val db = DBMaker.fileDB("./.tmp/eventstore.db").closeOnJvmShutdown().make()
val storage = MapDbEventStorageEngine(db)
val embeddedEventStore = EmbeddedEventStore(storage)
val projection = BankAccountProjection()
val configuration = DefaultConfigurer.defaultConfiguration()
.configureEventStore { _ -> embeddedEventStore }
.registerModule(EventHandlingConfiguration()
.registerEventHandler { _ -> projection })
.registerQueryHandler { _ -> projection }
.configureAggregate(BankAccount::class.java)
.buildConfiguration()
configuration.start()
val commandGateway = configuration.commandGateway()
println("accounts: ${projection.accounts}")
//commandGateway.sendAndWait<Any>(CreateAccountCommand("1"))
println("accounts: ${projection.accounts}")
println("events: ${storage.events.values}")
assertThat(storage.events).hasSize(1)
commandGateway.sendAndWait<Any>(DepositCommand("1", 100))
println("accounts: ${projection.accounts}")
println("events: ${storage.events.values}")
}
I am getting some (minor?) issues with serialization and reflection ...
Question: What do you think about this approach? Has this been done before? Is it worth to poceed or a waste of time?
Looking forward for feedback
Jan