Hello, We are using axon framework in project with postgres sql for event store.
We are using default setting of hibernate with allocationSize set to 50 and have 5 instances of the application running.
We see that some of the events in domain event entry are not getting processed.
For instance, we have token value at 2501 with gaps [2401,2402, 2410…2499] and domain event inserted at index 2403. As per our understanding since it is not part of the gaps array it is not getting processed.
Would like to understand the instances this may happen? Why would some ids got cleaned even after not processed and within the gap threshold window
Hi @Hina_Watts, welcome to the forum
I am afraid you are hitting an issue with the sequence generation on the domain_event_entry
table. I am guessing you are using JPA, meaning you are using Axon Framework’s old default sequence generator.
We defined the sequence behavior before Hibernate 6 switched the allocation size to 50. If we were to change the sequence generator right now, that would pose a breaking change to our users. As such, we have not (but will for Axon Framework 5).
Instead, we drafted a dedicated section about this in the documentation, clarifying our suggestions for sequence generation when using an RDBMS for event storage instead of Axon Server (Axon Server does not have any gaps, ever). You can find that description here.
So, you are not hitting actual gaps. These are artificial gaps, caused by the setup of your event store. Thus, you don’t have to be worried about them, nor that they are being cleaned.
By the way, the cleaning process is done on purpose by any RDBMS-based EventStorageEngine
in Axon Framework for this exact reason. Otherwise, you could get TrackingTokens
with millions of gaps. This, actually, happened to a user in the past, and was a rather nasty problem to resolve.
By the way, you can influence the gap cleaning behavior, by adjusting the JpaEventStorageEngine
or JdbcEventStorageEngine
through either builder. I would suggest checking the JavaDoc for either, if you want to go that route.
I hope that with the above, I have explained the situation sufficiently. If questions remain, be sure to reach out!