AxonFramework

Implementation of Command Query Responsibility Segregation (CQRS) architecture in Java can be a challenging task if performed from scratch, but is very elegant using the AxonFramework. This allows for building of central concepts of CQRS and fosters the usage of event sourcing by providing different event stores for that. The main advantage of event sourcing is the possibility to trigger a replay of the events and re-create the view-side projections from that. This is particular interesting, if the view-side is using non-persistent store of the domain model projection, like cache.

AxonFramework offers two ways of event listener registration. Monitoring event processors are registered on the EventSource in a way that the event delivery is performed synchronously in the same thread. Events delivered in the past can’t be replayed for monitoring event processors. Tracking event processors are registered on the EventSource in a way that a special token is maintained for every event processor, indicating the last event the processor has received. AxonFramework tries to deliver all events between last delivered and latest to the event processor.

continue reading…