Thursday, October 29, 2015

Exploring CQRS with Axon Framework: Applying Event Sourcing

This post is part of the series of post on exploring CQRS architecture using Axon Framework. It looks into combining event sourcing within CQRS using Axon Framework.

The previous posts in this series has explored the various components of a CQRS application and in Introducing Domain Events and Event Handling, we are able to put everything together. We did all that without bringing in event sourcing, showing that it is possible to have a CQRS architecture easily without introducing event sourcing. But in this post, we do just that: introduce event sourcing.

There is a project on Github (exploringCQRSwithAxon) that accompanies these series of posts. It is a trivial application where we can perform debiting, crediting and transferring of money between two dummy accounts. The code in the project is meant to help illustrate the application of the Axon framework to building CQRS application.

Saturday, October 17, 2015

Exploring CQRS with Axon Framework: Introducing Domain Events and Event Handling

This is a post in a series of posts that explores the CQRS architecture with Axon Framework. It is recommended to read the previous posts in this series before going ahead with this one, as that would help in forming a thread of continuity around the topic being discussed. You can start from Exploring CQRS Architecture with Axon Framework: Introduction

There is a Github project (exploringCQRSwithAxon) that contains a simple application that accompanies the posts in this series. it is an illustrative application that allows debiting, crediting and transferring money between two fictitious accounts. It is obvious a trivial application, which is on purpose. It’s aim is not to capture any complex domain but to help illustrates the various components of a CQRS architecture and how the Axon Framework can be used to build these various components.

Tuesday, October 13, 2015

Exploring CQRS with Axon Framework: Building the Entity, Aggregate, Aggregate Root and Repository Components

The previous post provided a basic explanation of Entity, Aggregate, Aggregate Root, Repository and Domain Events which are some of the building blocks in Domain Driven Design. This post looks at using Axon Framework to create some of these building blocks.

In Exploring the Commands, Command Bus and Command Handler, we looked at the command handling aspect of CQRS using Axon, where we had commands created, that were dispatched into a command bus via a command gateway which were then subsequently handled by their respective command handlers.

But in that post, all what the command handlers did was to print to the console. In real life applications, you would want the commands to lead to some business logic being executed, which might lead to state change in the application.

Achieving that, is what we look into in this post.

Monday, October 12, 2015

Exploring CQRS with Axon Framework: Overview of Some DDD Concepts

In Exploring the Commands, Command Bus and Command Handler, we looked at the command handling aspect of CQRS using Axon. We created commands that were dispatched into a command bus via a command gateway, which were then subsequently handled by their respective command handlers.

But in that post, all the command handlers did was to print to the console. In real life applications, you would want the commands to lead to state change within your application. Achieving this is what we look into next, but for us to do that, we would first need to explore some concepts that stem from the Domain Driven Design world. Namely Entities, Aggregates, Aggregate Roots, Repositories and Domain Events.

At this junction, it is worth mentioning that concepts and ideas from DDD always pop up in a typical CQRS discussion...this post and others in the series are not an exception, therefore, at least a basic understanding of these DDD concepts will be beneficiary.

This post will provide a quick overview of the relevant DDD concepts without touching on Axon Framework, while the next post will look at how Axon is used for their implementation.

That been said, let us quickly have an overview of the relevant DDD concepts that we will be needing in our exploration of CQRS with the Axon Framework.

Saturday, October 03, 2015

Exploring CQRS with Axon Framework: The Command, Command Bus and Command Handling Components

In this post we look at how to use Axon Framework to build out the command handling parts in a CQRS application.

It is part of a series of post that explores CQRS with Axon Framework.

As stated in the introductory post, these series of post is accompanied by the exploringCQRSwithAxon  project on Github. The project is a trivial application that simulates two bank accounts. It will support debiting, crediting and transfer between these two accounts. It is intended to help illustrate the features discussed as we explore how Axon Framework can be used to build application following CQRS stipulations.

The sample application is built with Axon Framework and Spring Boot. It uses the 2.4.1 version of Axon Framework, as you will notice in the Pom.xml

<dependency>
   <groupId>org.axonframework</groupId>
   <artifactId>axon-core</artifactId>
   <version>2.4.1</version>
  </dependency>
  <dependency>
   <groupId>org.axonframework</groupId>
   <artifactId>axon-test</artifactId>
   <version>2.4.1</version>
   <scope>test</scope>
  </dependency>

For the purpose of this series we would be using only the axon-core and axon-test modules.

Exploring CQRS Architecture with Axon Framework: Introduction

This is a first post in a series of posts that explores the CQRS architecture with Axon Framework.

The aim is to first understand what CQRS is from a conceptual/architectural standpoint and then explore what building blocks the Axon Framework provides that can help in building applications following the CQRS pattern.

The posts in this series include:
  1. Exploring CQRS with Axon Framework: The Command, Command Bus and Command Handling Components
  2. Exploring CQRS with Axon Framework: Overview of Some DDD concepts: Entity.
  3. Exploring CQRS with Axon Framework: Building the Entity, Aggregate, Aggregate Root and Repository components
  4. Exploring CQRS with Axon Framework: Introducing Domain Events and Event Handling.
  5. Exploring CQRS with Axon Framework: Applying Event Sourcing.
  6. Exploring CQRS with Axon Framework: Overview of the Testing infrastructure.
  7. Exploring CQRS with Axon Framework: Closing thoughts.

Friday, October 02, 2015

Exploring Architectures

I would be spending some time in the next couple of days/weeks/months, exploring software architectures.

Software Architecture is obviously a very broad subject to contemplate. It could also be an ambiguous one. So I am going to exploit this ambiguity and broadness and limit my exploration only to activities which piques my interest (:p) meaning what my exploration will be mostly concerned with the development/deploying side of things (nothing on analysis, requirement engineering etc)

Why do this? Two main personal motivation.

There are a lot of buzz words and terminologies, and acronyms and what have you swirling around the activity of putting software together. From DDD to Layered Architecture, to Microservice architecture, to Command Query Responsibility Segregation, to Message Driven Architecture, to Reactive systems, to...you get the point? And obviously there are overlaps in the concepts these words represents: therein lay the first motivation: To cut through all these ideas and get to the core of the know-how they represents when it comes to putting Software together.

Then there are the slew of libraries and frameworks that are supposed to help build software following these aforementioned ideas: From Akka, to AxonFramework, to RxJava, to Reactor, to Vertx: list is almost endless. (As you might have guessed my exploring of the topic will be heavily influenced by the tools available in the Java/JVM ecosystem)

Second motivation is then a logical follow up off the first one: applicability. Make sense of the plenitude of tools out there. Know when their usage is most appropriate and how they help in applying the various ideas around putting software systems together.

I am definitely curious to see the ideas and tools (libraries/frameworks) these exploration would lead me in contact/familiarity with...posts that falls into this category will be aptly tagged “Software Architecture”.