Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real life experience with the Axon Framework [closed]

Tags:

java

cqrs

axon

As part of researching CQRS for use with a project, I ran across the Axon Framework, and I was wondering if anyone has any real life experience with it. Just to be clear, I'm asking about the framework, not CQRS as an architectural pattern.

My project already uses Spring and Spring Integration which fits nicely with Axon's own requirements, but before i dedicate a lot of time to it, I would like to know if anyone has some first hand experience. In particular I'm interested i possible pitfalls that are not immediately apparent from the documentation.

like image 759
mhvelplund Avatar asked Mar 10 '12 13:03

mhvelplund


People also ask

What is axon Framework used for?

Axon Framework is a Java framework that provides implementations of the most important building blocks, e.g. aggregates, command and event buses, as well as repositories to help developers apply the CQRS architectural pattern when building applications, Dadepo Aderemi writes in a series of blog posts explaining CQRS ...

Is axon a open source Framework?

Open SourceAxon Framework is free. Axon's sources are available in a Git repository on GitHub.

What is axon messaging?

Messaging Concepts. One of the core concepts in Axon is messaging. All communication between components is done using message objects. This gives these components the location transparency needed to be able to scale and distribute these components when necessary.‌


2 Answers

The framework relies heavily on eventsourcing, which means that all state changes are >written to the data store as events. "

This is completely untrue, it does not rely heavily on event-sourcing. One of the implementations for storing the aggregate in this framework use Event-Sourcing but you can easily use also the classes provided to use a standard relational model.

It is just better with event-sourcing.

So you have a historical reference of all your data. This is nice but makes changing your >domain after you've gone in production a very daunting proposition especially if you sold >the customer on the system's "strong auditability" "

I don't think it is a lot easier with a standard relational model that only stores the current state.

The framework encourages denormalizing your data, to the point that some have suggested >having a table per view in the application. This makes your application extremely >difficult to maintain, especially when the original developers are gone"

This is unrelated to the framework but to the architectural pattern in use (CQRS). And sorry to mention that but having one denormalizer/view is a good idea as it stays a simple object.

So maintenance is easy because SQL request/insertion as also easy. So this argument is not very strong. How about a view which uses a 1000 tables model with inner joins everywhere and complex SQL queries?

Again, CQRS helps because, basically, the view data is just a SELECT * from the table which correspond to the view.

if somehow you made a mistake in one of the eventhandlers, your only option is to >"replay" the eventlog, which depending on the size of your data can take a very long >time. The tooling for this however is non-existent.

I agree on the point that currently there is a lack of tooling to replay events and that this can take a long time. However, it is theoretically possible to only replay a portion of the event and not all the content of the event store.

Replaying can have side effects, so >developers become scared of doing it

Replaying event have side effects -> that's untrue. For me side effects means modifying the state of the system. In an event-sourced CQRS application, the state is stored in the event-store. Replaying the events does not modify the event store. You can have side effect on the query side of the model yes. But you don't care if you have made a mistake because you are still able to correct it and replay the event once again.

it's extremely easy to have developers mess up using this framework. if they don't store >changes to domain objects in events, next time you replay your events you are in for a >surprise.

Well if you misused and misunderstand the architecture, the concept, etc. then ok I agree with you. But perhaps the problem is not the framework here.

Should you store delta's ? absolute values ? if you don't keep tabs on your developers >you are bound to end up with both and you will be f***ed

I can say that for every system I would say that it's unrelated directly to the framework itself. It's like saying, "Java is crap because you can messed up everything if someone codes a bad implementation of hashCode and equals methods."

And for the last part of your comment, I already seen samples like helloWorld with the Spring framework. Of course it is completely useless in a simple example.

Be careful in your comment to make a difference between the concept (CQRS + EventSourcing) and the framework. Make a difference please.

like image 170
FrenchSpidey Avatar answered Sep 30 '22 09:09

FrenchSpidey


Since you have stated that you want to use CQRS for your project (and I assume that the JVM is your target platform) I think Axon Framework is an excellent choice.

I have built a fairly complex trading platform on it (no, the trading sample is not complex) and I have not seen any obvious flaws of the framework.

Since I use EventSourcing, the test fixtures made it very easy to write BDD style "given, when, then" tests. This lets you treat an aggregate as a black box and concentrate on checking that the correct set of events come out when you put in a certain command.

About pitfalls: before jumping in, make sure

  1. That you have the concepts of CQRS figured out.
  2. Make a list (paper, whiteboard, whatever) of all your aggregates, command handlers, event handlers, sagas, commands and events. This is the hard part of building your system, figuring out what it should do and how. After this, the reference manual should show you how to wire it all together with Axon.

Some non Axon specific points:

Being able to rebuild the view store from events is a concept of EventSourcing, and not something that is exclusive to Axon, but I found it pretty easy to create a service that will send me all events from an aggregate type, aggregate id or a certain event type.

Being able to build a new reporting component one year after the project is launched and instantly get reports on data from the time of the project launch and onwards is awesome.

like image 35
Per Wiklander Avatar answered Sep 30 '22 08:09

Per Wiklander