I am new to the Axon Framework. I like it very much. However, I have to admit that if I did not have someone one my team who have experience with it, I may not be able to use it because, though there is very verbose documentation on the theory / thought process of why thing are done in axon, there are almost no documentation on how to actually implement it, make practical use of it. Given the quality of Axon’s implementation, this is very, very frustrating.
I would like to use the Axon sequence numbers. I think they prevent stale data updates to the event store; they essentially server the same function as version numbers do in support of optimistic locking in JPA. I found my way to section 5.3.2 in the Axon Reference Guide. What is described there is exactly what I want to do. However, there is no example of how to do it. I also took a look at the advanced conflict revision section–I don’t want to resolve the conflicts programmatically for my use case. I just want to be able to let the user know that the conflict has occurred. Also, looked at the Address Book sample app and did not see an example there either. I would love to make use of sequence numbers and here are me questions:
How do I interact with the Axon API to make use of sequence numbers?
a. Do I need to send the sequence number in as part of the commands?
b. Do I need to include the sequence number as a data member in my domain objects?
c. Should I include the sequence number in the domain events?
d. Should I provide the initial sequence number or is there some way to have Axon start it off?
e. Will the sequence number be incremented by axon (or, I suspect the underlying JPA) or do I have to manage the increments myself?
f. I notice that there is a get version method on the AbstractAggregateRoot class. How does that relate to the sequence number?
g. What is the relationship between the eventRevision and the sequenceNumber that I see on the DomainEvent class?
I am requesting an example / code snippets for two scenarios (the examples could answer questions a through e):
- the creation sequence from the command being created and being send through the command gateway until the resulting events are applied in the domain,
- the update sequence from the command being created and being send through the command gateway until the resulting events are applied in the domain.
Thank you for this wonderful framework and thank you for helping me to make use of it,