Hej,
I am playing around a bit with Axon and hit a bit of a roadbump. I started by making an easy application with 1 aggregateroot and a few command and events, and everything went fine. Now I am trying to persist the events in mongodb and to have the aggregates be eventsourced. But i keep running into this exception:
Default configuration requires the use of event sourcing. Either configure an Event Store to use, or configure a specific repository implementation for class be.tribersoft.command.aggregate.TodoList
My Configuration looks like this:
@Configuration
public class AxonJavaConfig {
@Bean
EventBus eventBus() {
return new SimpleEventBus();
}
@Bean
public MongoClient mongo() throws UnknownHostException {
return new MongoClient("127.0.0.1", 27017);
}
@Bean
public MongoTemplate mongoSpringTemplate() throws UnknownHostException {
return new MongoTemplate(mongo(), "tribertodo");
}
@Bean
public org.axonframework.mongo.eventsourcing.eventstore.MongoTemplate mongoTemplate() throws UnknownHostException {
return new DefaultMongoTemplate(mongo(), "tribertodo", "domainevents", "snapshotevents");
}
@Bean
public EventStore eventStore() throws UnknownHostException {
return new EmbeddedEventStore(eventStorageEngine());
}
@Bean
public MongoEventStorageEngine eventStorageEngine() throws UnknownHostException {
return new MongoEventStorageEngine(mongoTemplate());
}
@Bean
public Repository<TodoList> todoListCommandRepository() throws UnknownHostException {
return new EventSourcingRepository<TodoList>(TodoList.class, eventStore());
}
@Bean
public TodoListCommandHandler todoListCommandHandler() throws UnknownHostException {
return new TodoListCommandHandler(todoListCommandRepository());
}
}
My aggregate looks like this (written in Kotlin)