Token_Entry collection not created in mongodb

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

Hi Bin,

Axon Framework currently doesn’t provide a Mongo TokenStore, so I’d guess that’s why you don’t see any tokens being stored.
There is however a PR open for it, scheduled for Axon 3.1.
If you need it right now, you can take a look there how Joris solves the issue.

Hope this helps!

Cheers,

Steven

Hi Steven,

Thanks very much for the information! Could you share the link to Joris’ solution though?

Regards,
Bin

That’s the PR Steven referred to:
https://github.com/AxonFramework/AxonFramework/pull/295