First of all, many thanks for the great framework, I am new to Axon Framework and I feel I am already falling in love with it. In short, here is my setting and problem:
Axon Server SE.
Spring Cloud App as gateway, distributing incoming REST requests to mircroservices (Spring Boot Apps) via Axon Framework.
One of the microservices (so far the only one implemented) uses MongoDB for storing/retrieving documents. I have set up a MongoDB based token store and use the same MongoDB as for documents (as suggested in Axon Guide).
The ‘Document’ aggregate has proper 'CommandHandler’s and 'EventSourcingHandler’s for creating and updating documents.
A ‘DocumentProjection’ service – a Spring Boot Service with ProcessingGroup(“documents”) – has several 'EventHandler’s which are applied events by the Document aggregate’s command handlers, and care about maintaining the projection database, MongoDB it is, and retrieving documents via fetch events, accordingly.
The described setting above is nothing special, it follows the Axon examples such as giftcard, hotel reservation, etc. Now, here is my problem.
- During the development I have refined the ‘Document’ aggregate and restructured things such as event classes. And somehow I came several times into the situation, that my event handlers in DocumentProjection service did not get invoked anymore. I have deeply dived into axon sources and could not find the reason. But I could make an observation: every time I ran into this problem, I deleted the trackingtokens collection in MongoDB and restarted the service, and suddenly all events began to be delivered as expected, also those, which I had missed when I created or updated documents which did not arrive before.
Is there something special I have to consider to avoid such a situation? It seems that the trackingtokens get out of sync with the axon server, and I could not understand, how I managed to break the trackingtokens. Could that have to do with playing with event classes?