1
votes

I developed a couple of E-Commerce sites, I noticed the axonframework recently. I'm considering how to implement an new E-Commerce site with axonframework.

I mean to use standard repositories to persist aggregates(in our case, they are orders) simply, but we also need the order history for review purpose. I wonder if we can use event Sourcing repositories to persist all event on an order to implement order history or not.

Questions:

  1. Can I use both standard repositories and event Sourcing repositories in axonframework?
  2. If I can use both standard repositories and event Sourcing repositories, how axonframework load an aggregate by identifier, is it done by standard repository or event Sourcing repository?
  3. Any suggest is appreciated.

Thanks in advance.

1

1 Answers

4
votes

In essence, you don't need Event Sourcing to be able to record all events from a system; you need an Event Store. In Axon, an Event Store is a specialized version of the Event Bus, which stores all Events in an EventStorageEngine (e.g. JPA, JDBC or Mongo) before publishing them to all listeners.

In respect to Repository, you can only use a single Repository to load an Aggregate. It's either Event Sourced, or it's not. When it's Event Sourced, the Aggregate is reconstructed using the Events that it published in the past. Otherwise, an ORM mechanism will reconstruct current state based on the data stored in the database.