Hi,
I’m new to axon framework and trying to make a POC for event replay using springboot and mongoDB. I was able to replay the events successfully but then I can’t find any token_entry collection created in my MongoDB. Could someone help me to take a look. It seems a very simple question, but I just couldn’t find any topic on this. My configuration as below.
application.properties
# mongo
mongodb.url=127.0.0.1
mongodb.port=27017
# mongodb.username=
# mongodb.password=
mongodb.dbname=axon
mongodb.events.collection.name=events
mongodb.events.snapshot.collection.name=snapshots
AxonConfiguration.java
@Configuration
public class AxonConfiguration {
@Value("${mongodb.url}")
private String mongoUrl;
@Value("${mongodb.dbname}")
private String mongoDbName;
@Value("${mongodb.events.collection.name}")
private String eventsCollectionName;
@Value("${mongodb.events.snapshot.collection.name}")
private String snapshotCollectionName;
@Bean
public Serializer axonJsonSerializer() {
return new JacksonSerializer();
}
@Autowired
public void configure(EventHandlingConfiguration config) {
config.registerTrackingProcessor("merchantProcessor"); // default all processors to tracking mode.
}
@Bean
public EventStorageEngine eventStorageEngine(){
return new MongoEventStorageEngine(axonJsonSerializer(),null, axonMongoTemplate(), new DocumentPerEventStorageStrategy());
}
@Bean(name = "axonMongoTemplate")
public MongoTemplate axonMongoTemplate() {
MongoTemplate template = new DefaultMongoTemplate(mongoClient(), mongoDbName, eventsCollectionName, snapshotCollectionName);
return template;
}
@Bean
public MongoClient mongoClient(){
MongoFactory mongoFactory = new MongoFactory();
mongoFactory.setMongoAddresses(Arrays.asList(new ServerAddress(mongoUrl)));
return mongoFactory.createMongo();
}
Regards,
Bin