Event Sourcing on Azure

Hi All! With this post, we’ll start a new Series about Event Sourcing on Azure. We’re going to talk a bit about the pattern, general architecture, and the individual building blocks. Then in the next posts, we’ll dig more and see each one in detail.

If you’re a regular reader of this blog, you might know that I wrote already about Event Sourcing in the past. It’s a complex pattern, probably one of the most complex to get right. I enjoy the challenges it gives and how it causes a whole plethora of other patterns to be evaluated in conjunction (CQRS anyone?).

Building Microservices Through Event-Driven Architecture, Part 7: Implementing Event Sourcing on Repositories

Learn more about implementing event sourcing!

In this article, I will talk about Event Sourcing implementation on Repository.

The repository is responsible for adding events to the eventstore and also retrieving all events from the event store.

When the aggregate is saved, then all uncommitted events related to that aggregateroot are added to the eventstore table.

Building Microservices With Event-Driven Architecture, Part 1: Application-Specific Business Rules

Image source: https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html

Today, architectures such as the onion or hexagonal patterns play an important role in the testability and maintenance of code, its independence from external frameworks, etc. In this tutorial, I will show you how to use clean architecture, with methods and tools such as Domain-Driven Design (DDD), Test (Behavior) Driven Development (TDD), CQRS, Event Sourcing, Containerization, OAuth2, and Oidc to build a microservices architecture.

Parameter Resolvers in Axon

Axon is an open-source Java framework for building systems in CQRS (Command Query Responsibility Segregation), DDD (Domain Driven Design), and Event Sourcing manner. Axon provides a high level of location transparency, which gives the opportunity to easily split the system into several microservices. You can download the fully open-source package here. The Axon Framework consists of message-based commands, events, and queries that are supported types of messages. For each of these messages, we can define a handler (a method or constructor) to handle it. In some cases, the message itself has enough information to be handled, but in many others, we have a dependency on other components and/or variables (message metadata such as correlation information would be a good example). Axon provides a really powerful mechanism to inject these dependencies into message handlers — Parameter Resolvers. This is the story about them. At the end of this article, you can find a cheat sheet of all resolvers provided by the Axon Framework.

Anatomy

There are two important components that support this mechanism: the  ParameterResolver and the  ParameterResolverFactory (see Figure 1).