You can use Axon Server as an Event Store. That’s what it is But there is a significant difference between an Event Store and State Store (RDBMS, NoSQL DB, etc.).
With an Event Store, you don’t save the state of the
Aggregate. Only the events it produces. Then you reconstruct the
Aggregate instance from those events when needed. Thus no current “state” of the
Aggregate can be queried. You ONLY need an identifier to find the relevant events and construct an instance.
If you absolutely need to store state, you can go for State Stored Aggregates. In this case you don’t need an Event Store but an Aggregate Repository. That can be an RDBMS, NoSQL DB, etc. But this gives you less flexibility, and you are overwriting (and thus losing old) data.
Axon Framework can construct objects representing your
Aggregate instances in both cases (from the events in the Event Store or the state in a configured Aggregate Repository). Either way, for any state-changing operation, all you need is to find the right instance that can make the change. To use an analogy, it makes no sense to say, “Someone called Milen, please respond to this message”. You’d want to say “@milendyankov, please respond to this message” instead.
For none state-changing operations (read-only), you’d want to build projections containing the data you can query. Those can be stored in DBs or files or in-memory or anything else. You can have many of those, each serving a different purpose in the most performant way for the given use case.
That, in essence, is what CQRS is about. Separating the write model from the read model. You are correct in pointing out that you can query the write model using a state-stored approach. But that is a side effect of the storage solution. it is not something your application should rely on. Unfortunately (or luckily ) event stores do not offer that functionality.
Finally, let me tell you, I know how hard it is to make that mental switch. Especially for people who have been building DB-backed (and thus state-storing) applications for years. I was there myself once. But trust me, once you do, you’ll never look back I’ve been trying my best to explain those concepts in my talks:
I hope those will help you better understand the software development concepts Axon follows. But there is more:
Please, take some time to explore those. And if you need help, do not hesitate to drop another post here.